File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about PriorityQueue

 
Fred Victa
Ranch Hand
Posts: 180
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 4846
34
Chrome Netbeans IDE Windows
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic