Creates a max-priority queue.
Protected Optional_toThe converter used to transform a raw element (R) into a public element (E).
Get the number of elements.
Heap size.
Protected_createProtected_createProtected_getProtected_spawnReturns an iterator over the structure's elements.
Rest...args: unknown[]Optional iterator arguments forwarded to the internal iterator.
An IterableIterator<E> that yields the elements in traversal order.
Insert an element.
Element to insert.
True.
Delete one occurrence of an element.
Element to delete.
True if an element was removed.
Finds the first element that satisfies the predicate and returns it.
Finds the first element of type S (a subtype of E) that satisfies the predicate and returns it.
The matched element typed as S, or undefined if not found.
Check if an equal element exists in the heap.
Element to search for.
True if found.
Map elements into a new heap of possibly different element type.
Mapping function (element, index, heap) → newElement.
Options for the output heap, including comparator for EM.
OptionalthisArg: unknownValue for this inside the callback.
A new heap with mapped elements.
Replace the backing array and rebuild the heap.
Iterable used to refill the heap.
Array of per-node results from fixing steps.
StaticfromStaticheapify
Max-oriented priority queue (max-heap) built on PriorityQueue. The default comparator orders primitive values in descending order. If you store objects, you must provide a custom comparator via PriorityQueueOptions.
Example