aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Priority queue Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Priority queue" Watch "Priority queue" New topic
Author

Priority queue

amarkirt saroay
Ranch Hand

Joined: Mar 16, 2008
Posts: 167
HOw is the Priority queue calling the comparator in this case?
I am not able to get at what time does the comparator sort the data inside the priority queue? Does it do at Queue creation? or on calling Poll()?

Please explain...I could not find the way even after debugging...!





SCJP-75%
SCWCD-82%
Taariq San
Ranch Hand

Joined: Nov 20, 2007
Posts: 189
If you debug again put a breakpoint in your compare method, you'll see that it's called for both the offer() and poll() methods.
They call fixup and fixDown respectively, those 2 do the comparing.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Priority queue
 
Similar Threads
Regarding PriorityQueue
priorityqueue class
priority queue!
Generics
Doubt in Using the PriorityQueue Class