"This class and its iterator implement all of the optional methods of the Collection and Iterator interfaces. The Iterator provided in method iterator() is not guaranteed to traverse the elements of the PriorityQueue in any particular order. If you need ordered traversal, consider using Arrays.sort(pq.toArray())."
So the queue is ordered, only the iterator does what he wants to.
Funny, I didn't find the page Barry called "Voices from the past". Because I searched the topics of the SCJP forum only with "PriorityQueue" and not with "Priority Queue"...
Yours, Bu.
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, that will fit in a stocking