Skip to main content
Deno 2 is finally here 🎉️
Learn more
class Queue
import { Queue } from "https://deno.land/x/sptaki@1.2.0/utils/collections/queue/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.