Interface representing a generic Queue ADT.

interface Queue<T> {
    size: number;
    clear(): void;
    dequeue(): undefined | T;
    enqueue(item: T): void;
    isEmpty(): boolean;
    peek(): undefined | T;
}

Type Parameters

  • T

Hierarchy

  • QueueBase<T>
    • Queue

Implemented by

Properties

Methods

Properties

size: number

Gets the number of elements in the collection.

Methods

  • Removes and returns the element from the queue

    Returns undefined | T

    returns the element from the queue.

  • Adds an element to the queue

    Parameters

    • item: T

      The element to add.

    Returns void

  • Returns true if the collection is empty.

    Returns boolean

    True if the collection is empty, otherwise false.

  • Returns the element from the queue without removing it

    Returns undefined | T

    returns the element from the queue without removing it.