--- jsr166/src/main/java/util/PriorityQueue.java 2013/10/22 15:21:30 1.98 +++ jsr166/src/main/java/util/PriorityQueue.java 2015/02/27 19:01:11 1.105 @@ -24,8 +24,8 @@ */ package java.util; + import java.util.function.Consumer; -import java.util.stream.Stream; /** * An unbounded priority {@linkplain Queue queue} based on a priority heap. @@ -77,7 +77,7 @@ import java.util.stream.Stream; * * @since 1.5 * @author Josh Bloch, Doug Lea - * @param the type of elements held in this collection + * @param the type of elements held in this queue */ public class PriorityQueue extends AbstractQueue implements java.io.Serializable { @@ -99,7 +99,7 @@ public class PriorityQueue extends Ab /** * The number of elements in the priority queue. */ - private int size = 0; + private int size; /** * The comparator, or null if priority queue uses elements' @@ -111,7 +111,7 @@ public class PriorityQueue extends Ab * The number of times this priority queue has been * structurally modified. See AbstractList for gory details. */ - transient int modCount = 0; // non-private to simplify nested class access + transient int modCount; // non-private for nested class access /** * Creates a {@code PriorityQueue} with the default initial @@ -393,7 +393,7 @@ public class PriorityQueue extends Ab * @return {@code true} if this queue contains the specified element */ public boolean contains(Object o) { - return indexOf(o) != -1; + return indexOf(o) >= 0; } /** @@ -435,7 +435,7 @@ public class PriorityQueue extends Ab * The following code can be used to dump the queue into a newly * allocated array of {@code String}: * - *
 {@code String[] y = x.toArray(new String[0]);}
+ *
 {@code String[] y = x.toArray(new String[0]);}
* * Note that {@code toArray(new Object[0])} is identical in function to * {@code toArray()}. @@ -476,7 +476,7 @@ public class PriorityQueue extends Ab * Index (into queue array) of element to be returned by * subsequent call to next. */ - private int cursor = 0; + private int cursor; /** * Index of element returned by most recent call to next, @@ -496,13 +496,13 @@ public class PriorityQueue extends Ab * We expect that most iterations, even those involving removals, * will not need to store elements in this field. */ - private ArrayDeque forgetMeNot = null; + private ArrayDeque forgetMeNot; /** * Element returned by the most recent call to next iff that * element was drawn from the forgetMeNot list. */ - private E lastRetElt = null; + private E lastRetElt; /** * The modCount value that the iterator believes that the backing