This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Priority queue

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...!



 
Taariq San
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic