PriorityQueue and mutable item behavior
From today, in Java: a user asked if changing the value of an item in a PriorityQueue would still result in the queue being correctly ordered. (He explained that he was doing this to prioritize based on counters, which makes sense. It’s worth noting that this blog entry is not about solving his problem, but about the behavior of PriorityQueue.) Getting items out of a PriorityQueue requires peek() and/or poll(). Let’s take...
Nov 11, 2014 — 4 minute(s) read