Skip to content

Typed API (TypeDoc)


Typed API (TypeDoc) / Dequeue

Class: Dequeue<E>

Defined in: queue.ts:607

Type Parameters

E

E

Value type.

Implements

Constructors

Constructor

new Dequeue<E>(elements?): Dequeue<E>

Defined in: queue.ts:619

Parameters

elements?

Iterable<E, any, any>

Returns

Dequeue<E>

Properties

comparator

comparator: Comparator<E>

Defined in: queue.ts:617

Comparator used for equality/sort checks.

Implementation of

IDequeue.comparator


size

size: number = 0

Defined in: queue.ts:611

Current element count.

Implementation of

IDequeue.size

Methods

[iterator]()

[iterator](): Iterator<E>

Defined in: queue.ts:780

Iterable

Returns

Iterator<E>

Implementation of

IDequeue.[iterator]


add()

add(e): void

Defined in: queue.ts:654

Append an element.

Parameters

e

E

Returns

void

Remarks

Complexity: Amortized O(1) unless stated otherwise.

Implementation of

IDequeue.add


addAll()

addAll(collection): void

Defined in: queue.ts:661

Append every element from another collection.

Parameters

collection

ICollection<E>

Returns

void

Remarks

Complexity: O(n + m) where m is collection.size.

Implementation of

IDequeue.addAll


clear()

clear(): void

Defined in: queue.ts:756

Remove all entries.

Returns

void

Remarks

Complexity: O(n)

Implementation of

IDequeue.clear


contains()

contains(element): boolean

Defined in: queue.ts:764

Test membership using the comparator when available.

Parameters

element

E

Returns

boolean

Remarks

Complexity: O(n) worst case

Implementation of

IDequeue.contains


dequeue()

dequeue(): E

Defined in: queue.ts:670

Remove and return the head element.

Returns

E

Dequeued value.

Remarks

Complexity: O(1) amortized

Implementation of

IDequeue.dequeue


enqueue()

enqueue(e): void

Defined in: queue.ts:630

Append an element to the tail.

Parameters

e

E

Value to enqueue.

Returns

void

Remarks

Complexity: O(1) amortized

Implementation of

IDequeue.enqueue


head(): E

Defined in: queue.ts:741

Peek the head without removal.

Returns

E

Head value.

Implementation of

IDequeue.head


isEmpty()

isEmpty(): boolean

Defined in: queue.ts:749

Check for emptiness.

Returns

boolean

true when size === 0.

Implementation of

IDequeue.isEmpty


pop()

pop(): E

Defined in: queue.ts:710

Pop and return the top value.

Returns

E

Removed value.

Remarks

Complexity: O(1)

Implementation of

IDequeue.pop


push()

push(e): void

Defined in: queue.ts:683

Push a value on top.

Parameters

e

E

Value to push.

Returns

void

Remarks

Complexity: O(1)

Implementation of

IDequeue.push


remove()

remove(target, isIndex): number | E

Defined in: queue.ts:848

Remove by value or index.

Parameters

target

Element or index.

number | E

isIndex

boolean = true

When true, treat e as index.

Returns

number | E

Removed element or index of removal.

Remarks

Complexity: O(n) worst case.

Implementation of

IDequeue.remove


reverseIterator()

reverseIterator(): Generator<E, void, unknown>

Defined in: queue.ts:797

Iterates elements from the most recently added to the earliest.

Returns

Generator<E, void, unknown>

Implementation of

IDequeue.reverseIterator


sort()

sort(cmp?): void

Defined in: queue.ts:814

Sort the structure using the provided comparator.

Parameters

cmp?

Comparator<E>

Optional comparator; falls back to the internal one.

Returns

void

Implementation of

IDequeue.sort


top()

top(): E

Defined in: queue.ts:732

Peek the top value without removing it.

Returns

E

Top value.

Implementation of

IDequeue.top

Built with VitePress – Released under the MIT License.