--- jsr166/src/main/java/util/PriorityQueue.java 2013/01/16 15:06:10 1.81
+++ jsr166/src/main/java/util/PriorityQueue.java 2013/01/19 18:18:10 1.85
@@ -60,7 +60,7 @@ import java.util.function.Block;
* the priority queue in any particular order. If you need ordered
* traversal, consider using {@code Arrays.sort(pq.toArray())}.
*
- *
Note that this implementation is not synchronized.
+ *
Note that this implementation is not synchronized.
* Multiple threads should not access a {@code PriorityQueue}
* instance concurrently if any of the threads modifies the queue.
* Instead, use the thread-safe {@link
@@ -451,7 +451,9 @@ public class PriorityQueue extends Ab
* this queue
* @throws NullPointerException if the specified array is null
*/
+ @SuppressWarnings("unchecked")
public T[] toArray(T[] a) {
+ final int size = this.size;
if (a.length < size)
// Make a new array of a's runtime type, but my contents:
return (T[]) Arrays.copyOf(queue, size, a.getClass());
@@ -783,10 +785,10 @@ public class PriorityQueue extends Ab
}
// wrapping constructor in method avoids transient javac problems
- final PriorityQueueSpliterator spliterator(int origin, int fence,
+ final PriorityQueueSpliterator spliterator(int origin, int fence,
int expectedModCount) {
- return new PriorityQueueSpliterator(this, origin, fence,
- expectedModCount);
+ return new PriorityQueueSpliterator(this, origin, fence,
+ expectedModCount);
}
public Stream stream() {