Queue
Class | Source Code
implements IQueue
Implementation of a queue, a FIFO (first in, first out) structure.
Constructors
Section titled “Constructors”new Queue()
Section titled “new Queue()”Accessors
Section titled “Accessors”isEmpty: boolean
Section titled “isEmpty: boolean”Whether the queue is empty.
length: number
Section titled “length: number”The number of items in the queue.
Methods
Section titled “Methods”clear(): void
Section titled “clear(): void”Clears the queue entirely.
dequeue(): undefined | T
Section titled “dequeue(): undefined | T”Removes the first item in the queue.
Returns
Section titled “Returns”The removed item, or undefined if the queue was empty.
enqueue(item: T): void
Section titled “enqueue(item: T): void”Adds the specified item to the end of the queue.
peek(): undefined | T
Section titled “peek(): undefined | T”Returns
Section titled “Returns”The first item in the queue, or undefined if the queue is empty.
toArray(): T[]
Section titled “toArray(): T[]”Returns
Section titled “Returns”The queue as an array.
toString(): string
Section titled “toString(): string”Returns
Section titled “Returns”The queue as a human-readable string.