PriorityQueue in Java
The Java library provides a generic class PriorityQueue:
- add(item) is the method we called insert
- peek() returns, but does not remove, the minimum element
- poll() removes and returns the minimum element,
the method we called deleteMin() above.
The PriorityQueue can be set up using .compareTo()
to order events according to their natural ordering, or using a