Class ReverseQueue<T>

An indexed queue where items are indexed beginning from the most recently enqueued item. Enqueuing an item pushes all existing indexes up by one and inserts the item at index 0. Dequeuing an item removes the item from the highest index and returns it.

Type Parameters

  • T

Constructors

Properties

Methods

Constructors

Properties

count: number = 0

The number of elements in the queue.

Methods

  • Enumerates the queue starting from the most recently enqueued item.

    Returns Generator<T, any, unknown>

    An enumerator which enumerates items in the queue.

  • Retrieves the item at an index in the queue.

    Parameters

    • index: number

      The index of the item to retrieve. The most recently enqueued item is at index 0.

    Returns T