A double-ended queue using a circular buffer.

Type Parameters

  • T

Implements

Constructors

  • Type Parameters

    • T

    Parameters

    • _capacity: number = DEFAULT_DEQUE_CAPACITY

      The initial capacity.

    • resizeFactor: number = DEFAULT_DEQUE_RESIZE_FACTOR

      The resize factor. When the buffer is full, it will resize to resizeFactor * capacity.

    Returns ArrayDeque<T>

Properties

_capacity: number = DEFAULT_DEQUE_CAPACITY

The initial capacity.

backIdx: number = -1
buffer: T[]
frontIdx: number = -1
resizeFactor: number = DEFAULT_DEQUE_RESIZE_FACTOR

The resize factor. When the buffer is full, it will resize to resizeFactor * capacity.

Accessors

Methods

  • Resizes this ArrayDeque to the new capacity. By default, it expands to 2x the current capacity. Does nothing if new capacity is less than current size.

    Parameters

    • newCapacity: number = ...

    Returns void

Generated using TypeDoc