99 |
|
/** |
100 |
|
* The number of elements in the priority queue. |
101 |
|
*/ |
102 |
< |
private int size; |
102 |
> |
int size; |
103 |
|
|
104 |
|
/** |
105 |
|
* The comparator, or null if priority queue uses elements' |
337 |
|
int i = size; |
338 |
|
if (i >= queue.length) |
339 |
|
grow(i + 1); |
340 |
+ |
siftUp(i, e); |
341 |
|
size = i + 1; |
341 |
– |
if (i == 0) |
342 |
– |
queue[0] = e; |
343 |
– |
else |
344 |
– |
siftUp(i, e); |
342 |
|
return true; |
343 |
|
} |
344 |
|
|
606 |
|
* avoid missing traversing elements. |
607 |
|
*/ |
608 |
|
@SuppressWarnings("unchecked") |
609 |
< |
private E removeAt(int i) { |
609 |
> |
E removeAt(int i) { |
610 |
|
// assert i >= 0 && i < size; |
611 |
|
modCount++; |
612 |
|
int s = --size; |
749 |
|
/** |
750 |
|
* Saves this queue to a stream (that is, serializes it). |
751 |
|
* |
752 |
+ |
* @param s the stream |
753 |
+ |
* @throws java.io.IOException if an I/O error occurs |
754 |
|
* @serialData The length of the array backing the instance is |
755 |
|
* emitted (int), followed by all of its elements |
756 |
|
* (each an {@code Object}) in the proper order. |
758 |
– |
* @param s the stream |
759 |
– |
* @throws java.io.IOException if an I/O error occurs |
757 |
|
*/ |
758 |
|
private void writeObject(java.io.ObjectOutputStream s) |
759 |
|
throws java.io.IOException { |
823 |
|
private int fence; // -1 until first use |
824 |
|
private int expectedModCount; // initialized when fence set |
825 |
|
|
826 |
< |
/** Creates new spliterator covering the given range */ |
826 |
> |
/** Creates new spliterator covering the given range. */ |
827 |
|
PriorityQueueSpliterator(PriorityQueue<E> pq, int origin, int fence, |
828 |
< |
int expectedModCount) { |
828 |
> |
int expectedModCount) { |
829 |
|
this.pq = pq; |
830 |
|
this.index = origin; |
831 |
|
this.fence = fence; |