This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Question about PriorityQueue" Watch "Question about PriorityQueue" New topic
Author

Question about PriorityQueue

Fred Victa
Ranch Hand

Joined: May 01, 2008
Posts: 86
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>();
x.add(2);
x.add(66);
x.add(23);
x.add(1);
x.add(3);
System.out.println(x);
}

}
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3602
    
  14

So what does the program output? Does it match you expectations? Did you read the class documentation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about PriorityQueue
 
Similar Threads
Collecction/Generics
doubt priorityqueue
generics wildcard
Priority Queue
Done with SCJP; Advices and Error in K&B