HeapPriorityQueue<E> constructor

HeapPriorityQueue<E>([int comparison(E e1, E e2) ])

Create a new priority queue.

The comparison is a Comparator used to compare the priority of elements. An element that compares as less than another element has a higher priority.

If comparison is omitted, it defaults to Comparable.compare. If this is the case, E must implement Comparable, and this is checked at runtime for every comparison.

Implementation

HeapPriorityQueue([int comparison(E e1, E e2)])
    : comparison = comparison ?? defaultCompare<E>();