• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[SCJP] PriorityQueue order

 
Paulo Gervásio
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have one doubt about how PriorityQueue prints yours items when calls toString() ...
Let me explain better, I have this code:


and it prints [1, 3, 2]...

Look what the JavaDoc says about Iterator:
Returns an iterator over the elements in this queue. The iterator does not return the elements in any particular order.


Anyone knows what is this order or in what its based?

Thanks.

Ps.: This code I found in http://scjptest.com
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question has been asked many times before like here, here and here...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic