Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
class Queue
import { Queue } from "https://deno.land/x/sptaki@1.2.0/utils/collections/mod.ts";

Constructors

new
Queue()

Properties

private
list
readonly
length: number

Methods

Removes the first element from the queue and returns it's value. If the queue is empty, undefined is returned and the queue is not modified.

enqueue(element: T): void

Adds an element to the end of the queue.

enqueueAll(elements: T[]): void

Iterates over the elements received and adds each one to the end of the queue.

peek(): T

Returns the first element's value.