Flocc
    Preparing search index...

    Class PriorityQueue<T>

    A min-heap based priority queue. Elements with lower priority values are dequeued first.

    0.6.0

    Type Parameters

    • T
    Index

    Constructors

    • Create a new PriorityQueue.

      Type Parameters

      • T

      Parameters

      • compareFn: (a: T, b: T) => number = ...

        Comparison function. Should return negative if a < b, positive if a > b, zero if equal. Defaults to numeric comparison.

      Returns PriorityQueue<T>

    Accessors

    Methods

    • View the highest-priority element without removing it. Returns undefined if the queue is empty.

      Returns T

    • Remove and return the highest-priority element. Returns undefined if the queue is empty.

      Returns T

    • Remove a specific item from the queue. Returns true if the item was found and removed.

      Parameters

      • item: T

      Returns boolean

    • Remove all elements matching a predicate. Returns the number of elements removed.

      Parameters

      • predicate: (item: T) => boolean

      Returns number