Typed API (TypeDoc) / LinkedQueue
Class: LinkedQueue<E>
Defined in: queue.ts:271
Type Parameters
E
E
Implements
IQueue<E>
Constructors
Constructor
new LinkedQueue<
E>(elements?,comparator?):LinkedQueue<E>
Defined in: queue.ts:283
Parameters
elements?
Iterable<E, any, any>
comparator?
Comparator<E>
Returns
LinkedQueue<E>
Properties
comparator
comparator:
Comparator<E>
Defined in: queue.ts:281
Comparator used for equality/sort checks.
Implementation of
size
size:
number=0
Defined in: queue.ts:277
Current element count.
Implementation of
Methods
[iterator]()
[iterator]():
Iterator<E>
Defined in: queue.ts:389
Iterates through the LinkedQueue.
Returns
Iterator<E>
Iterator for the LinkedQueue
Remarks
Complexity: O(n)
Implementation of
IQueue.[iterator]
add()
add(
e):void
Defined in: queue.ts:312
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:319
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:360
Remove all entries.
Returns
void
Remarks
Complexity: O(n)
Implementation of
contains()
contains(
element):boolean
Defined in: queue.ts:371
Checks if an element is contained in the LinkedQueue. For this function to work, a comparator must be set!
Parameters
element
E
Returns
boolean
Remarks
Complexity: O(size) amortized
Implementation of
dequeue()
dequeue():
E
Defined in: queue.ts:328
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:297
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:352
Peek the head without removal.
Returns
E
Head value.
Implementation of
isEmpty()
isEmpty():
boolean
Defined in: queue.ts:345
Check for emptiness.
Returns
boolean
true when size === 0.
Implementation of
remove()
remove(
target,isIndex):number|E
Defined in: queue.ts:456
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>
Defined in: queue.ts:406
Iterates elements from the most recently added to the earliest.
Returns
Generator<E>
Implementation of
sort()
sort(
cmp?):void
Defined in: queue.ts:420
Sort the structure using the provided comparator.
Parameters
cmp?
Comparator<E>
Optional comparator; falls back to the internal one.
Returns
void