Ankit Garg wrote:When you display a PriorityQueue directly or using iterator, the ordering of elements is not guaranteed. The natural ordering is only guaranteed for peek and offer methods. Checkout the javadocs for PriorityQueue class, you'll get your answer...
Hello Ankit,
I tried this :
that resulted in [l,s,p] instead [l,p,s]
I am also confused with usage of offer() for NaturalOrder
Can you help me, please?