[cvs] / jsr166 / src / main / java / util / concurrent / LinkedTransferQueue.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53, Mon Feb 18 01:30:24 2013 UTC revision 1.54, Mon Feb 25 17:59:40 2013 UTC
# Line 16  Line 16 
16  import java.util.concurrent.TimeUnit;  import java.util.concurrent.TimeUnit;
17  import java.util.concurrent.locks.LockSupport;  import java.util.concurrent.locks.LockSupport;
18  import java.util.Spliterator;  import java.util.Spliterator;
19    import java.util.Spliterators;
20  import java.util.stream.Stream;  import java.util.stream.Stream;
21  import java.util.stream.Streams;  import java.util.stream.Streams;
22  import java.util.function.Consumer;  import java.util.function.Consumer;
# Line 928  Line 929 
929              Node p; int n;              Node p; int n;
930              final LinkedTransferQueue<E> q = this.queue;              final LinkedTransferQueue<E> q = this.queue;
931              if (!exhausted && (n = batch + 1) > 0 && n <= MAX_BATCH &&              if (!exhausted && (n = batch + 1) > 0 && n <= MAX_BATCH &&
932                  ((p = current) != null || (p = q.firstDataNode()) != null)) {                  ((p = current) != null || (p = q.firstDataNode()) != null) &&
933                    p.next != null) {
934                  Object[] a = new Object[batch = n];                  Object[] a = new Object[batch = n];
935                  int i = 0;                  int i = 0;
936                  do {                  do {
# Line 939  Line 941 
941                  } while (p != null && i < n);                  } while (p != null && i < n);
942                  if ((current = p) == null)                  if ((current = p) == null)
943                      exhausted = true;                      exhausted = true;
944                  return Collections.arraySnapshotSpliterator                  return Spliterators.spliterator
945                      (a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |                      (a, 0, i, Spliterator.ORDERED | Spliterator.NONNULL |
946                       Spliterator.CONCURRENT);                       Spliterator.CONCURRENT);
947              }              }
# Line 987  Line 989 
989              return false;              return false;
990          }          }
991    
992            public long estimateSize() { return Long.MAX_VALUE; }
993    
994          public int characteristics() {          public int characteristics() {
995              return Spliterator.ORDERED | Spliterator.NONNULL |              return Spliterator.ORDERED | Spliterator.NONNULL |
996                  Spliterator.CONCURRENT;                  Spliterator.CONCURRENT;

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8