ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/PriorityQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/PriorityQueue.java (file contents):
Revision 1.85 by jsr166, Sat Jan 19 18:18:10 2013 UTC vs.
Revision 1.86 by dl, Tue Jan 22 19:28:05 2013 UTC

# Line 803 | Line 803 | public class PriorityQueue<E> extends Ab
803      }
804  
805      /** Index-based split-by-two Spliterator */
806 <    static final class PriorityQueueSpliterator<E>
807 <        implements Spliterator<E>, Iterator<E> {
806 >    static final class PriorityQueueSpliterator<E> implements Spliterator<E> {
807          private final PriorityQueue<E> pq;
808          private int index;           // current index, modified on advance/split
809          private final int fence;     // one past last index
# Line 821 | Line 820 | public class PriorityQueue<E> extends Ab
820              int lo = index, mid = (lo + fence) >>> 1;
821              return (lo >= mid) ? null :
822                  new PriorityQueueSpliterator<E>(pq, lo, index = mid,
823 <                                            expectedModCount);
823 >                                                expectedModCount);
824          }
825  
826          public void forEach(Block<? super E> block) {
# Line 842 | Line 841 | public class PriorityQueue<E> extends Ab
841  
842          public boolean tryAdvance(Block<? super E> block) {
843              if (index >= 0 && index < fence) {
845                if (pq.modCount != expectedModCount)
846                    throw new ConcurrentModificationException();
844                  @SuppressWarnings("unchecked") E e =
845                      (E)pq.queue[index++];
846                  block.accept(e);
847 +                if (pq.modCount != expectedModCount)
848 +                    throw new ConcurrentModificationException();
849                  return true;
850              }
851              return false;
# Line 855 | Line 854 | public class PriorityQueue<E> extends Ab
854          public long estimateSize() { return (long)(fence - index); }
855          public boolean hasExactSize() { return true; }
856          public boolean hasExactSplits() { return true; }
858
859        // Iterator support
860        public Iterator<E> iterator() { return this; }
861        public void remove() { throw new UnsupportedOperationException(); }
862        public boolean hasNext() { return index >= 0 && index < fence; }
863
864        public E next() {
865            if (index < 0 || index >= fence)
866                throw new NoSuchElementException();
867            if (pq.modCount != expectedModCount)
868                throw new ConcurrentModificationException();
869            @SuppressWarnings("unchecked") E e =
870                (E) pq.queue[index++];
871            return e;
872        }
857      }
858   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines