PriorityQueue<E> constructor

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

Creates an empty PriorityQueue.

The created PriorityQueue is a plain HeapPriorityQueue.

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

factory PriorityQueue([int comparison(E e1, E e2)]) = HeapPriorityQueue<E>;