SequencedCollection
Defined in: src/interfaces/Collection.ts:125
A collection with a defined encounter order and two accessible ends: lists, deques, LinkedHashSet, TreeSet.
Sorted collections place elements themselves, so their addFirst/addLast throw UnsupportedOperationException.
Extends
Section titled “Extends”Collection<E>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”E
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<E,any,any>
Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:47
Returns
Section titled “Returns”Iterator<E, any, any>
Inherited from
Section titled “Inherited from”add(
e):boolean
Defined in: src/interfaces/Collection.ts:54
Ensures this collection contains e.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”boolean
true if the collection changed (a set returns false for a duplicate)
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Throws
Section titled “Throws”NullPointerException if e is null and this collection rejects null
Throws
Section titled “Throws”IllegalArgumentException if some property of e prevents adding it (for example a key outside a
sorted view’s range)
Throws
Section titled “Throws”IllegalStateException if a capacity-bounded queue is full
Inherited from
Section titled “Inherited from”addAll()
Section titled “addAll()”addAll(
c):boolean
Defined in: src/interfaces/Collection.ts:73
Adds every element of c, in c’s iteration order. c is copied first, so addAll(this) terminates.
Parameters
Section titled “Parameters”Collection<E>
Returns
Section titled “Returns”boolean
true if this collection changed
Throws
Section titled “Throws”NullPointerException if c is null, or contains null and this collection rejects null
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Inherited from
Section titled “Inherited from”addFirst()
Section titled “addFirst()”addFirst(
e):void
Defined in: src/interfaces/Collection.ts:133
Adds e as the first element (for a set that already holds it, moves it to the front).
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable or sorted
Throws
Section titled “Throws”NullPointerException if e is null and this collection rejects null
addLast()
Section titled “addLast()”addLast(
e):void
Defined in: src/interfaces/Collection.ts:139
Adds e as the last element (for a set that already holds it, moves it to the end).
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable or sorted
Throws
Section titled “Throws”NullPointerException if e is null and this collection rejects null
clear()
Section titled “clear()”clear():
void
Defined in: src/interfaces/Collection.ts:99
Removes all elements.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Inherited from
Section titled “Inherited from”contains()
Section titled “contains()”contains(
o):boolean
Defined in: src/interfaces/Collection.ts:37
Returns true if this collection contains an element equal to o (by Objects.equals).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if o is null and this collection rejects null (for example the immutable
collections and sorted collections with natural ordering)
Inherited from
Section titled “Inherited from”containsAll()
Section titled “containsAll()”containsAll(
c):boolean
Defined in: src/interfaces/Collection.ts:66
Returns true if this collection contains every element of c.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Inherited from
Section titled “Inherited from”equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/interfaces/Collection.ts:105
Compares this collection with o for equality. A List equals any other List with the same elements in the
same order; a Set equals any other Set with the same elements; other collections (queues, deques, values()
views) use identity.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”forEach()
Section titled “forEach()”forEach(
action):void
Defined in: src/interfaces/Collection.ts:27
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
Throws
Section titled “Throws”ConcurrentModificationException if action structurally modifies this collection
Inherited from
Section titled “Inherited from”getFirst()
Section titled “getFirst()”getFirst():
E
Defined in: src/interfaces/Collection.ts:144
Returns the first element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this collection is empty
getLast()
Section titled “getLast()”getLast():
E
Defined in: src/interfaces/Collection.ts:149
Returns the last element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this collection is empty
hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/interfaces/Collection.ts:110
Returns a hash code consistent with equals. A list hashes as h = 31 * h + hash(e) starting from 1, a set as
the sum of its element hashes (both in 32-bit arithmetic); other collections use an identity hash.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/interfaces/Collection.ts:31
Returns true if this collection has no elements.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”iterator()
Section titled “iterator()”iterator():
Iterator<E>
Defined in: src/interfaces/Collection.ts:21
Returns a fail-fast iterator over the elements, in this collection’s encounter order (if it has one).
Its remove() throws UnsupportedOperationException on an unmodifiable collection.
Returns
Section titled “Returns”Iterator<E>
Inherited from
Section titled “Inherited from”parallelStream()
Section titled “parallelStream()”parallelStream():
Stream<E>
Defined in: src/interfaces/Collection.ts:118
Returns a stream flagged as parallel; it is evaluated sequentially (JS is single-threaded).
Returns
Section titled “Returns”Stream<E>
Inherited from
Section titled “Inherited from”remove()
Section titled “remove()”remove(
o):boolean
Defined in: src/interfaces/Collection.ts:61
Removes one element equal to o, if present.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
true if an element was removed
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Throws
Section titled “Throws”NullPointerException if o is null and this collection rejects null
Inherited from
Section titled “Inherited from”removeAll()
Section titled “removeAll()”removeAll(
c):boolean
Defined in: src/interfaces/Collection.ts:80
Removes every element that is also contained in c.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
true if this collection changed
Throws
Section titled “Throws”NullPointerException if c is null
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Inherited from
Section titled “Inherited from”removeFirst()
Section titled “removeFirst()”removeFirst():
E
Defined in: src/interfaces/Collection.ts:155
Removes and returns the first element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this collection is empty
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
removeIf()
Section titled “removeIf()”removeIf(
filter):boolean
Defined in: src/interfaces/Collection.ts:87
Removes every element for which filter returns true.
Parameters
Section titled “Parameters”filter
Section titled “filter”(e) => boolean
Returns
Section titled “Returns”boolean
true if any element was removed
Throws
Section titled “Throws”NullPointerException if filter is null
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable and an element matches
Inherited from
Section titled “Inherited from”removeLast()
Section titled “removeLast()”removeLast():
E
Defined in: src/interfaces/Collection.ts:161
Removes and returns the last element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this collection is empty
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
retainAll()
Section titled “retainAll()”retainAll(
c):boolean
Defined in: src/interfaces/Collection.ts:94
Keeps only the elements that are also contained in c, removing all others.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
true if this collection changed
Throws
Section titled “Throws”NullPointerException if c is null
Throws
Section titled “Throws”UnsupportedOperationException if this collection is unmodifiable
Inherited from
Section titled “Inherited from”reversed()
Section titled “reversed()”reversed():
SequencedCollection<E>
Defined in: src/interfaces/Collection.ts:127
Returns a live reverse-ordered view: changes through either side are visible in the other.
Returns
Section titled “Returns”SequencedCollection<E>
size()
Section titled “size()”size():
number
Defined in: src/interfaces/Collection.ts:29
Returns the number of elements.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”spliterator()
Section titled “spliterator()”spliterator():
Spliterator<E>
Defined in: src/interfaces/Collection.ts:114
Returns a spliterator over the elements, used to build streams. Fail-fast like the iterator.
Returns
Section titled “Returns”Spliterator<E>
Inherited from
Section titled “Inherited from”stream()
Section titled “stream()”stream():
Stream<E>
Defined in: src/interfaces/Collection.ts:116
Returns a sequential stream over this collection.
Returns
Section titled “Returns”Stream<E>
Inherited from
Section titled “Inherited from”toArray()
Section titled “toArray()”Call Signature
Section titled “Call Signature”toArray():
E[]
Defined in: src/interfaces/Collection.ts:39
Returns a new array with all elements, in iteration order. Changing the array does not affect this collection.
Returns
Section titled “Returns”E[]
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”toArray<
A>(generator):A
Defined in: src/interfaces/Collection.ts:44
Fills an array created by generator(size()), in iteration order, and returns it; e.g. n => new Float64Array(n).
Type Parameters
Section titled “Type Parameters”A extends WritableArrayLike<E>
Parameters
Section titled “Parameters”generator
Section titled “generator”(length) => A
creates the target array for a given length
Returns
Section titled “Returns”A
Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: src/interfaces/Collection.ts:112
Returns the elements in iteration order as [a, b, c]; an element that is this collection prints as (this Collection).
Returns
Section titled “Returns”string