AbstractSet
Defined in: src/abstract/AbstractSet.ts:22
Skeleton implementation of the Set interface on top of AbstractCollection.
A read-only subclass implements iterator() and size() and must not yield duplicates; a modifiable one also
overrides add(e) (which throws UnsupportedOperationException by default) and returns an iterator whose
remove() works. It inherits value equals with any Set, hashCode as the sum of element hashes, a
removeAll that walks the smaller side, and a DISTINCT spliterator (SORTED | ORDERED too for a set with
comparator(), first(), last() and headSet()). There is no modCount: 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”Set<E>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AbstractSet<
E>():AbstractSet<E>
Returns
Section titled “Returns”AbstractSet<E>
Inherited from
Section titled “Inherited from”AbstractCollection.constructor
Accessors
Section titled “Accessors”[SET_BRAND]
Section titled “[SET_BRAND]”Get Signature
Section titled “Get Signature”get [SET_BRAND]():
true
Defined in: src/abstract/AbstractSet.ts:24
Runtime brand that marks this object as a Set (TypeScript interfaces do not exist at runtime); always true.
Returns
Section titled “Returns”true
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”Set.[iterator]
Inherited from
Section titled “Inherited from”add(
_e):boolean
Defined in: src/abstract/AbstractCollection.ts:60
Adds e; returns true if the collection changed. Not supported by default.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”UnsupportedOperationException unless a subclass overrides it
Implementation of
Section titled “Implementation of”Set.add
Inherited from
Section titled “Inherited from”addAll()
Section titled “addAll()”addAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:96
Calls add for each element of a snapshot of c (so addAll(this) terminates); returns true if any call
changed the collection.
Parameters
Section titled “Parameters”Collection<E>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Throws
Section titled “Throws”UnsupportedOperationException if add is not supported and c is not empty
Implementation of
Section titled “Implementation of”Set.addAll
Inherited from
Section titled “Inherited from”clear()
Section titled “clear()”clear():
void
Defined in: src/abstract/AbstractCollection.ts:145
Removes every element by walking the iterator and calling its remove().
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if the iterator does not support remove() and the collection is not empty
Implementation of
Section titled “Implementation of”Set.clear
Inherited from
Section titled “Inherited from”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”Set.contains
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”Set.containsAll
Inherited from
Section titled “Inherited from”AbstractCollection.containsAll
equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/abstract/AbstractSet.ts:37
Returns true if o is a Set of the same size that this set containsAll of; any Set implementation
compares. A ClassCastException or NullPointerException from containsAll counts as “not equal”.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Set.equals
Overrides
Section titled “Overrides”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”Set.forEach
Inherited from
Section titled “Inherited from”hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/abstract/AbstractSet.ts:81
Returns the sum of the element hashes (32-bit), so equal sets hash the same whatever their order.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Set.hashCode
Overrides
Section titled “Overrides”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”Set.isEmpty
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”Set.iterator
Inherited from
Section titled “Inherited from”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”Set.parallelStream
Inherited from
Section titled “Inherited from”AbstractCollection.parallelStream
remove()
Section titled “remove()”remove(
o):boolean
Defined in: src/abstract/AbstractCollection.ts:68
Removes the first element equal to o through the iterator’s remove(); returns true if one was removed.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”UnsupportedOperationException if the iterator does not support remove() and a match is found
Implementation of
Section titled “Implementation of”Set.remove
Inherited from
Section titled “Inherited from”removeAll()
Section titled “removeAll()”removeAll(
c):boolean
Defined in: src/abstract/AbstractSet.ts:56
Removes every element also in c. Walks the smaller side, sized by size(): when this set is larger, iterates c and calls this.remove(e) for each element (so this set’s equality decides, and remove(null) may throw NullPointerException); otherwise iterates this set, removing (iterator.remove, via removeIf) each element c.contains().
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null, or this set contains null and c does not permit null
Implementation of
Section titled “Implementation of”Set.removeAll
Overrides
Section titled “Overrides”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”Set.removeIf
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”Set.retainAll
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”Set.size
Inherited from
Section titled “Inherited from”spliterator()
Section titled “spliterator()”spliterator():
Spliterator<E>
Defined in: src/abstract/AbstractSet.ts:72
Late-binding DISTINCT|SIZED|SUBSIZED spliterator over iterator(); for a sorted set (one with comparator, first, last and headSet) DISTINCT|SORTED|ORDERED|SIZED|SUBSIZED with getComparator() = comparator(). Like the reference, traversal does not lower estimateSize().
Returns
Section titled “Returns”Spliterator<E>
Implementation of
Section titled “Implementation of”Set.spliterator
Overrides
Section titled “Overrides”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”Set.stream
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”Set.toArray
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”Set.toArray
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
Implementation of
Section titled “Implementation of”Set.toString