PriorityQueue<E> constructor Null safety

PriorityQueue<E>(
  1. [int comparison(
    1. E,
    2. E
    )?]
)

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 Function(E, E)? comparison]) =
    HeapPriorityQueue<E>;