Custom implementation of a double ended queue.

Type Parameters

  • T

Constructors

Properties

_capacity?: number
_capacityMask: number
_head: number
_list: (undefined | T)[]
_tail: number

Accessors

Methods

  • Returns the item at the specified index from the list. 0 is the first element, 1 is the second, and so on... Elements at negative values are that many from the end: -1 is one before the end (the last element), -2 is two before the end (one before last), etc. Returns undefined if the index is out of bounds.

    Parameters

    • index: number

    Returns undefined | T

  • Remove and return the item at the specified index from the list. Returns undefined if the list is empty.

    Parameters

    • index: number

    Returns undefined | T