Typed API (TypeDoc) / Dequeue
Class: Dequeue<E>
Defined in: queue.ts:607
Type Parameters
E
E
Value type.
Implements
IDequeue<E>
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
size
size:
number=0
Defined in: queue.ts:611
Current element count.
Implementation of
Methods
[iterator]()
[iterator]():
Iterator<E>
Defined in: queue.ts:780
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
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
clear()
clear():
void
Defined in: queue.ts:756
Remove all entries.
Returns
void
Remarks
Complexity: O(n)
Implementation of
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
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
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
head()
head():
E
Defined in: queue.ts:741
Peek the head without removal.
Returns
E
Head value.
Implementation of
isEmpty()
isEmpty():
boolean
Defined in: queue.ts:749
Check for emptiness.
Returns
boolean
true when size === 0.
Implementation of
pop()
pop():
E
Defined in: queue.ts:710
Pop and return the top value.
Returns
E
Removed value.
Remarks
Complexity: O(1)
Implementation of
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
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
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
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
top()
top():
E
Defined in: queue.ts:732
Peek the top value without removing it.
Returns
E
Top value.