AbstractQueue
Defined in: src/abstract/AbstractQueue.ts:16
Skeleton implementation of the Queue interface for queues that reject null elements, since a null from
poll()/peek() always means “empty”.
A subclass implements offer, poll, peek, iterator() and size(). It inherits the throwing variants
add (IllegalStateException when offer refuses), remove() and element()
(NoSuchElementException when empty), plus clear (polls until empty) and addAll. Fail-fast behaviour is
whatever the subclass’s iterator provides.
Extends
Section titled “Extends”Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”E
Implements
Section titled “Implements”Queue<E>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AbstractQueue<
E>():AbstractQueue<E>
Returns
Section titled “Returns”AbstractQueue<E>
Inherited from
Section titled “Inherited from”AbstractCollection.constructor
Methods
Section titled “Methods”[INSPECT]()
Section titled “[INSPECT]()”[INSPECT]():
string
Defined in: src/abstract/AbstractCollection.ts:195
Node’s util.inspect hook: console.log prints the toString() form.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”[iterator]()
Section titled “[iterator]()”[iterator]():
IterableIterator<E>
Defined in: src/abstract/AbstractCollection.ts:164
Makes the collection usable with for..of and spread; walks iterator().
Returns
Section titled “Returns”IterableIterator<E>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”add(
e):boolean
Defined in: src/abstract/AbstractQueue.ts:28
Inserts e via offer; returns true.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”IllegalStateException if offer returns false (the queue is full)
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”addAll()
Section titled “addAll()”addAll(
c):boolean
Defined in: src/abstract/AbstractQueue.ts:68
Calls add for each element of c; returns true if the queue changed.
Parameters
Section titled “Parameters”Collection<E>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Throws
Section titled “Throws”IllegalArgumentException if c is this queue
Throws
Section titled “Throws”IllegalStateException if the queue fills up part-way (earlier elements stay added)
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”clear()
Section titled “clear()”clear():
void
Defined in: src/abstract/AbstractQueue.ts:58
Removes every element by calling poll() until it returns null.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”contains()
Section titled “contains()”contains(
o):boolean
Defined in: src/abstract/AbstractCollection.ts:34
Returns true if some element equals o (by Objects.equals); a linear scan of iterator().
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”containsAll()
Section titled “containsAll()”containsAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:83
Returns true if this collection contains every element of c (calls contains for each).
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”AbstractCollection.containsAll
element()
Section titled “element()”element():
E
Defined in: src/abstract/AbstractQueue.ts:51
Returns the head without removing it, via peek.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the queue is empty
Implementation of
Section titled “Implementation of”equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/abstract/AbstractCollection.ts:185
Identity by default; List/Set/Map subclasses override with value equality.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”forEach()
Section titled “forEach()”forEach(
action):void
Defined in: src/abstract/AbstractCollection.ts:157
Calls action for each element in iteration order.
Parameters
Section titled “Parameters”action
Section titled “action”(e) => void
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if action is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/abstract/AbstractCollection.ts:190
Identity hash by default, consistent with the identity equals.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/abstract/AbstractCollection.ts:29
Returns size() === 0.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”iterator()
Section titled “iterator()”
abstractiterator():Iterator<E>
Defined in: src/abstract/AbstractCollection.ts:24
Returns an iterator over the elements. Subclasses implement it; its remove() backs every removal method.
Returns
Section titled “Returns”Iterator<E>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”offer()
Section titled “offer()”
abstractoffer(e):boolean
Defined in: src/abstract/AbstractQueue.ts:18
Inserts e if there is room; returns false when a bounded queue is full. Subclasses implement it and reject null.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”parallelStream()
Section titled “parallelStream()”parallelStream():
Stream<E>
Defined in: src/abstract/AbstractCollection.ts:180
Returns a stream over spliterator() flagged as parallel.
Returns
Section titled “Returns”Stream<E>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”AbstractCollection.parallelStream
peek()
Section titled “peek()”
abstractpeek():E|null
Defined in: src/abstract/AbstractQueue.ts:22
Returns the head without removing it, or null when empty. Subclasses implement it.
Returns
Section titled “Returns”E | null
Implementation of
Section titled “Implementation of”poll()
Section titled “poll()”
abstractpoll():E|null
Defined in: src/abstract/AbstractQueue.ts:20
Removes and returns the head, or null when empty. Subclasses implement it.
Returns
Section titled “Returns”E | null
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”Call Signature
Section titled “Call Signature”remove():
E
Defined in: src/abstract/AbstractQueue.ts:37
Removes and returns the head, via poll.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the queue is empty
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”remove(
o):boolean
Defined in: src/abstract/AbstractQueue.ts:39
Removes one element equal to o through the iterator; returns true if one was removed.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”AbstractCollection.remove
removeAll()
Section titled “removeAll()”removeAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:108
Removes every element that c contains, through the iterator’s remove(); returns true if any was removed.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”removeIf()
Section titled “removeIf()”removeIf(
filter):boolean
Defined in: src/abstract/AbstractCollection.ts:128
Removes every element for which filter returns true, through the iterator’s remove(); returns true if
any was removed.
Parameters
Section titled “Parameters”filter
Section titled “filter”(e) => boolean
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if filter is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”retainAll()
Section titled “retainAll()”retainAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:118
Removes every element that c does not contain, through the iterator’s remove(); returns true if any was
removed.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”size()
Section titled “size()”
abstractsize():number
Defined in: src/abstract/AbstractCollection.ts:26
Returns the number of elements. Subclasses implement it.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”spliterator()
Section titled “spliterator()”spliterator():
Spliterator<E>
Defined in: src/abstract/AbstractCollection.ts:170
Late-binding SIZED|SUBSIZED spliterator over iterator(), splitting in batches; collections override with faster ones.
Returns
Section titled “Returns”Spliterator<E>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”AbstractCollection.spliterator
stream()
Section titled “stream()”stream():
Stream<E>
Defined in: src/abstract/AbstractCollection.ts:175
Returns a sequential stream over spliterator().
Returns
Section titled “Returns”Stream<E>
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”toArray()
Section titled “toArray()”Call Signature
Section titled “Call Signature”toArray():
E[]
Defined in: src/abstract/AbstractCollection.ts:41
Returns a new array of the elements in iteration order.
Returns
Section titled “Returns”E[]
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”toArray<
A>(generator):A
Defined in: src/abstract/AbstractCollection.ts:48
Copies the elements in iteration order into generator(size()) and returns that array.
Type Parameters
Section titled “Type Parameters”A extends WritableArrayLike<E>
Parameters
Section titled “Parameters”generator
Section titled “generator”(length) => A
receives the element count and returns a plain or typed array of at least that length
Returns
Section titled “Returns”A
Throws
Section titled “Throws”IndexOutOfBoundsException if the generated typed array is too short
Throws
Section titled “Throws”NullPointerException if generator or its result is null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: src/abstract/AbstractCollection.ts:199
Returns [e1, e2, ...] in iteration order; an element that is this collection prints as (this Collection).
Returns
Section titled “Returns”string