Skip to content
On this page

PriorityQueue<T>.toArray

This implementation returns an array containing all the elements returned by this collection's iterator, in the same order, stored in consecutive elements of the array, starting with index 0. The length of the returned array is equal to the number of elements returned by the iterator, even if the size of this collection changes during iteration, as might happen if the collection permits concurrent modification during iteration. The length property is called only as an optimization hint; the correct result is returned even if the iterator returns a different number of elements.