Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/easyts/container/mod.ts>Queue

js library written with ts, use select and chan like golang in js.
Latest
class Queue
extends Basic<T>
import { Queue } from "https://deno.land/x/easyts@0.1.3/container/mod.ts";

A queue implemented using fixed-length arrays

Constructors

new
Queue(capacity?, opts?: Options<T>)

Properties

private
a_: Array<T>
private
offset_: number

offset of array

private
size_: number

queue size

readonly
capacity: number

returns the capacity of the queue

readonly
length: number

returns the length of the queue

Methods

clear(callback?: DeleteCallback<T>)

clear the queue

clone(callback?: CloneCallback<T>): Queue<T>

Create a full copy of the container

get(i: number): T

get queue element

iterator(reverse?: boolean): Iterator<T>

return js iterator

If the queue is not empty delete the element at the back

If the queue is not empty delete the element at the back

If the queue is not empty delete the element at the front

If the queue is not empty delete the element at the front

pushBack(val: T): boolean

inserts val at the back of queue

pushFront(val: T): boolean

inserts val at the front of queue

pushList(vals: Iterable<T>, callback?: CloneCallback<T>)

push a copy of another container of queue.

set(i: number, val: T): void

set queue element