Interface IQueue<T>

The Queue ADT.

Interface

IQueue

Type Parameters

  • T

    The type of all elements in the queue.

Hierarchy

  • IQueue

Implemented by

Accessors

  • get size(): number
  • Number of elements in the queue.

    Returns number

Methods

  • Removes the front element from the queue if not empty.

    Returns

    true on success, false otherwise.

    Returns boolean

  • Whether the queue has no elements.

    Returns

    true if the queue is empty, false otherwise.

    Returns boolean

  • Adds an element to the end of the queue.

    Parameters

    • elem: T

      The element to be added.

    Returns void

  • Gets the element at the front of the queue if not empty.

    Returns

    The front element.

    Returns null | T

  • Iterates over all elements of this queue from the front.

    The given operation will be performed on each element iterated.

    Parameters

    • action: ((elem: T) => void)

      The operation to be performed on each element.

        • (elem: T): void
        • Parameters

          • elem: T

          Returns void

    Returns void

  • Creates a string representation of this queue.

    Elements are presented in the queue order from left to right.

    Returns

    The string representation.

    Parameters

    • separator: string

      Element separator.

    Returns string

Generated using TypeDoc