PriorityQueue<T>.from constructor

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

Creates a PriorityQueue containing the elements of the given iterable.

The elements are built into a heap queue.

Implementation

PriorityQueue.from(Iterable<T> elements, [int Function(T, T)? compare])
  : _compare = compare ?? _defaultCompare {
  for (final element in elements) {
    push(element);
  }
}