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

Diff of /jsr166/src/main/java/util/PriorityQueue.java

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

revision 1.85, Sat Jan 19 18:18:10 2013 UTC revision 1.86, Tue Jan 22 19:28:05 2013 UTC
# Line 803  Line 803 
803      }      }
804    
805      /** Index-based split-by-two Spliterator */      /** Index-based split-by-two Spliterator */
806      static final class PriorityQueueSpliterator<E>      static final class PriorityQueueSpliterator<E> implements Spliterator<E> {
         implements Spliterator<E>, Iterator<E> {  
807          private final PriorityQueue<E> pq;          private final PriorityQueue<E> pq;
808          private int index;           // current index, modified on advance/split          private int index;           // current index, modified on advance/split
809          private final int fence;     // one past last index          private final int fence;     // one past last index
# Line 842  Line 841 
841    
842          public boolean tryAdvance(Block<? super E> block) {          public boolean tryAdvance(Block<? super E> block) {
843              if (index >= 0 && index < fence) {              if (index >= 0 && index < fence) {
                 if (pq.modCount != expectedModCount)  
                     throw new ConcurrentModificationException();  
844                  @SuppressWarnings("unchecked") E e =                  @SuppressWarnings("unchecked") E e =
845                      (E)pq.queue[index++];                      (E)pq.queue[index++];
846                  block.accept(e);                  block.accept(e);
847                    if (pq.modCount != expectedModCount)
848                        throw new ConcurrentModificationException();
849                  return true;                  return true;
850              }              }
851              return false;              return false;
# Line 855  Line 854 
854          public long estimateSize() { return (long)(fence - index); }          public long estimateSize() { return (long)(fence - index); }
855          public boolean hasExactSize() { return true; }          public boolean hasExactSize() { return true; }
856          public boolean hasExactSplits() { return true; }          public boolean hasExactSplits() { return true; }
   
         // Iterator support  
         public Iterator<E> iterator() { return this; }  
         public void remove() { throw new UnsupportedOperationException(); }  
         public boolean hasNext() { return index >= 0 && index < fence; }  
   
         public E next() {  
             if (index < 0 || index >= fence)  
                 throw new NoSuchElementException();  
             if (pq.modCount != expectedModCount)  
                 throw new ConcurrentModificationException();  
             @SuppressWarnings("unchecked") E e =  
                 (E) pq.queue[index++];  
             return e;  
         }  
857      }      }
858  }  }

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8