Java's PriorityQueue places the least element at the head of the list, however I need it to place the greatest element at the head. What what's the neatest way to get a priority queue that behaves like that.
Since I wrote the class stored in this queue I could simply reverse the results of compareTo
, its not used outside this queue.
However I like to make the code an accurate representation of what I'm modeling, what I'm trying to do is get the greatest first so the code should say that rather than least first with an unusual definition of least.
[edit]just a quick thank you everyone, Comparator sounds like what I need just as soon as I teach myself how to write one.