Class Deque<T>

Type Parameters

  • T

Hierarchy

Constructors

Methods

  • Description

    Remove all elements after the specified position (excluding the specified position).

    Example

    deque.cut(1); // Then deque's size will be 2. deque -> [0, 1]
    

    Parameters

    • pos: number

      The previous position of the _first removed element.

    Returns void

  • Description

    Iterate over all elements in the container.

    Parameters

    • callback: ((element: T, index: number) => void)

      Callback function like Array.forEach.

        • (element: T, index: number): void
        • Parameters

          • element: T
          • index: number

          Returns void

    Returns void

  • Description

    Insert several elements after the specified position.

    Parameters

    • pos: number

      The position you want to insert.

    • element: T

      The element you want to insert.

    • num: number = 1

      The number of elements you want to insert (default 1).

    Returns void

Generated using TypeDoc