--- jsr166/src/main/java/util/PriorityQueue.java 2015/06/16 23:06:01 1.106 +++ jsr166/src/main/java/util/PriorityQueue.java 2016/06/01 16:08:04 1.109 @@ -99,7 +99,7 @@ public class PriorityQueue extends Ab /** * The number of elements in the priority queue. */ - private int size; + int size; /** * The comparator, or null if priority queue uses elements' @@ -337,11 +337,8 @@ public class PriorityQueue extends Ab int i = size; if (i >= queue.length) grow(i + 1); + siftUp(i, e); size = i + 1; - if (i == 0) - queue[0] = e; - else - siftUp(i, e); return true; } @@ -609,7 +606,7 @@ public class PriorityQueue extends Ab * avoid missing traversing elements. */ @SuppressWarnings("unchecked") - private E removeAt(int i) { + E removeAt(int i) { // assert i >= 0 && i < size; modCount++; int s = --size; @@ -826,9 +823,9 @@ public class PriorityQueue extends Ab private int fence; // -1 until first use private int expectedModCount; // initialized when fence set - /** Creates new spliterator covering the given range */ + /** Creates new spliterator covering the given range. */ PriorityQueueSpliterator(PriorityQueue pq, int origin, int fence, - int expectedModCount) { + int expectedModCount) { this.pq = pq; this.index = origin; this.fence = fence;