--- jsr166/src/main/java/util/PriorityQueue.java 2016/12/18 21:52:10 1.116
+++ jsr166/src/main/java/util/PriorityQueue.java 2017/05/06 06:49:46 1.119
@@ -73,7 +73,7 @@ import java.util.function.Consumer;
* ({@code peek}, {@code element}, and {@code size}).
*
*
This class is a member of the
- *
+ *
* Java Collections Framework.
*
* @since 1.5
@@ -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());
@@ -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]);
}