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

    Class Deque<T>

    A double-ended queue (deque) implementation.

    Type Parameters

    • T

      The type of elements in the deque.

    Hierarchy (View Summary)

    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

    • Returns the item at the back of the deque without removing it.

      Returns undefined | T

      The item at the back of the deque, or undefined if the deque is empty.

    • Adds one or more items to the back of the deque.

      The items are added in the order they are provided, with the last item in the argument list becoming the new back of the deque.

      Parameters

      • ...items: T[]

        The items to add to the back of the deque.

      Returns void

      If the operation would exceed the deque's capacity.

    • Adds one or more items to the front of the deque.

      The items are added in the order they are provided, with the last item in the argument list becoming the new front of the deque.

      Parameters

      • ...items: T[]

        The items to add to the front of the deque.

      Returns void

      If the operation would exceed the deque's capacity.

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

      Parameters

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

        Optional abort signal to cancel the operation.

      Returns Promise<void>

      IDeque.push

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

      Parameters

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

        Optional abort signal to cancel the operation.

      Returns Promise<void>

      IDeque.unshift