Class Queue<T>

Queue

Type Parameters

  • T

    Type of queue items.

Hierarchy

  • Queue

Constructors

Properties

Accessors

Methods

Constructors

Properties

head: number
items: Record<number, T>
tail: number

Accessors

  • get size(): number
  • Get the size of the queue.

    Returns number

    The size of the queue.

Methods

  • Dequeue an item.

    Returns undefined | T

    The dequeued item or undefined if the queue is empty.

  • Enqueue an item.

    Parameters

    • item: T

      Item to enqueue.

    Returns number

    The new size of the queue.

  • Peek at the first item.

    Returns undefined | T

Generated using TypeDoc