GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • algorithms-ts
  • Options
  • Stack

This view

  • Original page
  • New address

GeezerVison is showing prishedko.github.io — Queue | algorithms-ts

The Queue class represents a first-in-first-out (FIFO) queue of generic elements. It supports the usual enqueue and dequeue operations, along with methods for peeking at the first item, testing if the queue is empty, and iterating through the items in FIFO order.

Type parameters

  • E

Hierarchy

  • Queue

Implemented by

  • LinkedQueue
  • PriorityQueue

Index

Methods

  • asCollection
  • dequeue
  • enqueue
  • isEmpty
  • peek
  • size
  • toString

Methods

asCollection

  • asCollection(): Collection<E>
    • Defined in containers/api.ts:98

    Returns collection backed by this queue. Iterations will be in FIFO order. Time complexity is O(1).

    Returns Collection<E>

    collection of elements from this queue.

dequeue

  • dequeue(): E
    • Defined in containers/api.ts:88

    Removes and returns the element on this queue that was least recently added.

    throws

    Error('Queue underflow') if this queue is empty.

    Returns E

    the element on this queue that was least recently added.

enqueue

  • enqueue(e: E): Queue<E>
    • Defined in containers/api.ts:82

    Adds the element to this queue.

    Parameters

    • e: E

      element the item to add.

    Returns Queue<E>

    queue with the added element.

isEmpty

  • isEmpty(): boolean
    • Defined in containers/api.ts:65

    Returns true if this queue is empty.

    Returns boolean

    true if this queue is empty; false otherwise

peek

  • peek(): E
    • Defined in containers/api.ts:76

    Returns the element least recently added to this queue.

    throws

    Error('Queue underflow') if this queue is empty.

    Returns E

    the element least recently added to this queue.

size

  • size(): number
    • Defined in containers/api.ts:70

    Returns the number of elements in this queue.

    Returns number

    the number of elements in this queue.

toString

  • toString(): string
    • Defined in containers/api.ts:93

    Returns a string representation of this queue.

    Returns string

    the sequence of elements in FIFO order, separated by spaces.

Generated using TypeDoc

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.