PriorityQueue<T> constructor

PriorityQueue<T>([
  1. int compare(
    1. T,
    2. T
    )?
])

Creates an empty PriorityQueue.

By default, it expects T to be Comparable to create a max-heap. You can provide a custom compare function to define priority.

Implementation

PriorityQueue([int Function(T, T)? compare])
  : _compare = compare ?? _defaultCompare;