--- jsr166/src/main/java/util/PriorityQueue.java 2016/12/02 07:11:36 1.115 +++ jsr166/src/main/java/util/PriorityQueue.java 2016/12/29 23:14:34 1.118 @@ -522,6 +522,8 @@ public class PriorityQueue extends Ab */ private int expectedModCount = modCount; + Itr() {} // prevent access constructor creation + public boolean hasNext() { return cursor < size || (forgetMeNot != null && !forgetMeNot.isEmpty()); @@ -631,7 +633,7 @@ public class PriorityQueue extends Ab * promoting x up the tree until it is greater than or equal to * its parent, or is the root. * - * To simplify and speed up coercions and comparisons. the + * To simplify and speed up coercions and comparisons, the * Comparable and Comparator versions are separated into different * methods that are otherwise identical. (Similarly for siftDown.) * @@ -732,12 +734,12 @@ public class PriorityQueue extends Ab @SuppressWarnings("unchecked") private void heapify() { final Object[] es = queue; - final int half = (size >>> 1) - 1; + int i = (size >>> 1) - 1; if (comparator == null) - for (int i = half; i >= 0; i--) + for (; i >= 0; i--) siftDownComparable(i, (E) es[i]); else - for (int i = half; i >= 0; i--) + for (; i >= 0; i--) siftDownUsingComparator(i, (E) es[i]); }