Set
Defined in: src/immutable/ImmutableCollections.ts:781
The set interface (collection without duplicates), declared under this name so Set works both as a type and as the
factory object with of, copyOf and ofLazy.
Extends
Section titled “Extends”Set<E>
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”SetType.[iterator]
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”SetType.add
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”SetType.addAll
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”SetType.clear
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”SetType.contains
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”SetType.containsAll
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”SetType.equals
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”SetType.forEach
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”SetType.hashCode
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”SetType.isEmpty
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”SetType.iterator
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”SetType.parallelStream
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”SetType.remove
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”SetType.removeAll
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”SetType.removeIf
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”SetType.retainAll
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”SetType.size
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”SetType.spliterator
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”SetType.stream
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”SetType.toArray
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”SetType.toArray
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
Inherited from
Section titled “Inherited from”SetType.toString