@ac-essentials/misc-util
    Preparing search index...

    Class Queue<T>

    A FIFO queue implementation.

    Type Parameters

    • T

      The type of elements in the queue.

    Hierarchy

    • LinkedListCollection<T>
      • Queue

    Implements

    Index

    Constructors

    Properties

    capacity: number = Infinity

    The maximum number of elements the collection can hold. If the collection is unbounded, this will be Infinity.

    data: LinkedList<T>

    Methods

    • Concatenates the given items to the end of the collection and returns an iterator over the merged items.

      This method does not mutate the original collection.

      Parameters

      • ...items: T[]

        The items to merge.

      Returns IterableIterator<T>

      An iterator of the merged items.

    • Adds one or more items to the rear of the queue.

      The items are added in the order they are provided. The last item in the argument list will be the last one to be dequeued.

      Parameters

      • ...items: T[]

        The items to add to the queue.

      Returns void

      If the operation would exceed the queue's capacity.

    • Replaces the first occurence of the item matching the given predicate in the collection with a new item.

      Parameters

      • condition: Predicate<[T]>

        A predicate function to identify the item to replace.

      • newItem: T

        The new item to insert.

      Returns boolean

      true if the item was found and replaced, false otherwise.

    • Same as enqueue, but waits for capacity if the operation would exceed it.

      Parameters

      • items: Iterable<T>
      • Optionalsignal: AbortSignal | null

        Optional abort signal to cancel the operation.

      Returns Promise<void>

      IQueue.enqueue