[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.86, Tue Jan 22 19:28:05 2013 UTC revision 1.87, Fri Feb 1 01:02:25 2013 UTC
# Line 27  Line 27 
27  import java.util.stream.Stream;  import java.util.stream.Stream;
28  import java.util.Spliterator;  import java.util.Spliterator;
29  import java.util.stream.Streams;  import java.util.stream.Streams;
30  import java.util.function.Block;  import java.util.function.Consumer;
31    
32  /**  /**
33   * An unbounded priority {@linkplain Queue queue} based on a priority heap.   * An unbounded priority {@linkplain Queue queue} based on a priority heap.
# Line 64  Line 64 
64   * Multiple threads should not access a {@code PriorityQueue}   * Multiple threads should not access a {@code PriorityQueue}
65   * instance concurrently if any of the threads modifies the queue.   * instance concurrently if any of the threads modifies the queue.
66   * Instead, use the thread-safe {@link   * Instead, use the thread-safe {@link
67   * java.util.concurrent.PriorityBlockingQueue} class.   * java.util.concurrent.PriorityConsumeringQueue} class.
68   *   *
69   * <p>Implementation note: this implementation provides   * <p>Implementation note: this implementation provides
70   * O(log(n)) time for the enqueing and dequeing methods   * O(log(n)) time for the enqueing and dequeing methods
# Line 823  Line 823 
823                                                  expectedModCount);                                                  expectedModCount);
824          }          }
825    
826          public void forEach(Block<? super E> block) {          public void forEach(Consumer<? super E> block) {
827              Object[] a; int i, hi; // hoist accesses and checks from loop              Object[] a; int i, hi; // hoist accesses and checks from loop
828              if (block == null)              if (block == null)
829                  throw new NullPointerException();                  throw new NullPointerException();
# Line 839  Line 839 
839              }              }
840          }          }
841    
842          public boolean tryAdvance(Block<? super E> block) {          public boolean tryAdvance(Consumer<? super E> block) {
843              if (index >= 0 && index < fence) {              if (index >= 0 && index < fence) {
844                  @SuppressWarnings("unchecked") E e =                  @SuppressWarnings("unchecked") E e =
845                      (E)pq.queue[index++];                      (E)pq.queue[index++];

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

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8