Options
All
  • Public
  • Public/Protected
  • All
Menu

A FIFO queue implemented with a singly-linked list.

Type parameters

  • E

Hierarchy

  • AbstractCollection<E>
    • SLLQueue

Implements

Index

Constructors

Accessors

  • get count(): number
  • get isEmpty(): boolean

Methods

  • [iterator](): Iterator<E, any, undefined>
  • clear(): void
  • dequeue(): E
  • enqueue(element: E): void
  • peek(): E
  • Retrieves, but does not remove, the head of this queue i.e. then item that will be removed if dequeue() is called.

    remarks

    Complexity:

    • Time complexity: O(1)
    • Space complexity: O(1)
    throws

    NoSuchElementError Thrown if the queue is empty.

    Returns E

    The head element.

  • toArray(): E[]
  • Converts the collection into a plain array.

    remarks

    Complexity:

    • Time complexity: O(N)
    • Space complexity: O(N)

    where:

    • N: number of items in the collection

    Returns E[]

    A new array containing all the items in the collection.

Generated using TypeDoc