jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Question about PriorityQueue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question about PriorityQueue" Watch "Question about PriorityQueue" New topic

Question about PriorityQueue

Fred Victa
Ranch Hand

Joined: May 01, 2008
Posts: 151
Is the following code supposed to place all of the integers in numerical order? If not, can anyone explain why?

public class myClass{

public static void main(String[] args)

PriorityQueue<Integer> x = new PriorityQueue<Integer>();

Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4087

So what does the program output? Does it match you expectations? Did you read the class documentation?

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
I agree. Here's the link: http://aspose.com/file-tools
subject: Question about PriorityQueue
It's not a secret anymore!