I use a PriorityBlockingQueue to maintain a list of objects whose order is dictated using a comparator. My requirement is as follows: First, I add N objects to the queue, and the queue maintains the ordered list with it. Later, I change the value in the objects that had been added to the queue. The issue is that the queue is not refreshed based on the updated values in the objects. In contrast, I observed that the queue is refreshed when a single object is removed.
Is there anyway I can manually refresh the values in the queue before obtaining values from it in a very efficient manner?
Not with PriorityBlockingQueue. It sounds like the option you’re looking for is decrease-key, which isn’t supported by the Java priority queue abstractions.