• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Priority queue  RSS feed

 
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...!



 
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
Boost this thread!