Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Priority Queues in Java

Tags:

java.util.PriorityQueue allows a Comparator to be passed at construction time. When inserting elements, they are ordered according to the priority specified by the comparator.

What happens when the priority of an element changes after it has been inserted? When does the PriorityQueue reorder elements? Is it possible to poll an element that does not actually have minimal priority?

Are there good implementations of a priority queue which allow efficient priority updates?