NavigableSet
Defined in: src/interfaces/Set.ts:69
A sorted set with navigation methods that return the closest match for a given element (lower, floor,
ceiling, higher, each null when there is none) and range views with explicit inclusive flags.
Extends
Section titled “Extends”SortedSet<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”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”ceiling()
Section titled “ceiling()”ceiling(
e):E|null
Defined in: src/interfaces/Set.ts:84
Returns the least element greater than or equal to e, or null if there is none.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”E | null
Throws
Section titled “Throws”NullPointerException if e is null and this set 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”comparator()
Section titled “comparator()”comparator():
Comparator<E> |null
Defined in: src/interfaces/Set.ts:31
Returns the comparator that orders this set, or null when it uses natural ordering.
Returns
Section titled “Returns”Comparator<E> | null
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”descendingIterator()
Section titled “descendingIterator()”descendingIterator():
Iterator<E>
Defined in: src/interfaces/Set.ts:97
Returns a fail-fast iterator over the elements in descending order.
Returns
Section titled “Returns”Iterator<E>
descendingSet()
Section titled “descendingSet()”descendingSet():
NavigableSet<E>
Defined in: src/interfaces/Set.ts:95
Returns a live view of this set in descending order: changes through either side are visible in the other.
Returns
Section titled “Returns”NavigableSet<E>
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”first()
Section titled “first()”first():
E
Defined in: src/interfaces/Set.ts:36
Returns the lowest element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this set is empty
Inherited from
Section titled “Inherited from”floor()
Section titled “floor()”floor(
e):E|null
Defined in: src/interfaces/Set.ts:79
Returns the greatest element less than or equal to e, or null if there is none.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”E | null
Throws
Section titled “Throws”NullPointerException if e is null and this set rejects null
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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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”headSet()
Section titled “headSet()”Call Signature
Section titled “Call Signature”headSet(
toElement):SortedSet<E>
Defined in: src/interfaces/Set.ts:102
Returns a live view of the elements strictly less than toElement; same as headSet(toElement, false).
Parameters
Section titled “Parameters”toElement
Section titled “toElement”E
Returns
Section titled “Returns”SortedSet<E>
Throws
Section titled “Throws”IllegalArgumentException if this set is itself a range view and toElement is outside its range
Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”headSet(
toElement,inclusive):NavigableSet<E>
Defined in: src/interfaces/Set.ts:108
Returns a live view of the elements less than (or, if inclusive, equal to) toElement.
Parameters
Section titled “Parameters”toElement
Section titled “toElement”E
inclusive
Section titled “inclusive”boolean
Returns
Section titled “Returns”NavigableSet<E>
Throws
Section titled “Throws”IllegalArgumentException if this set is itself a range view and toElement is outside its range
Throws
Section titled “Throws”NullPointerException if toElement is null and this set rejects null
Overrides
Section titled “Overrides”SortedSet.headSet
higher()
Section titled “higher()”higher(
e):E|null
Defined in: src/interfaces/Set.ts:89
Returns the least element strictly greater than e, or null if there is none.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”E | null
Throws
Section titled “Throws”NullPointerException if e is null and this set rejects null
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”last()
Section titled “last()”last():
E
Defined in: src/interfaces/Set.ts:41
Returns the highest element.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if this set is empty
Inherited from
Section titled “Inherited from”lower()
Section titled “lower()”lower(
e):E|null
Defined in: src/interfaces/Set.ts:74
Returns the greatest element strictly less than e, or null if there is none.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”E | null
Throws
Section titled “Throws”NullPointerException if e is null and this set rejects null
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”pollFirst()
Section titled “pollFirst()”pollFirst():
E|null
Defined in: src/interfaces/Set.ts:91
Removes and returns the lowest element, or null if this set is empty.
Returns
Section titled “Returns”E | null
pollLast()
Section titled “pollLast()”pollLast():
E|null
Defined in: src/interfaces/Set.ts:93
Removes and returns the highest element, or null if this set is empty.
Returns
Section titled “Returns”E | null
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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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():
NavigableSet<E>
Defined in: src/interfaces/Set.ts:135
Returns a live descending view; same as descendingSet().
Returns
Section titled “Returns”NavigableSet<E>
Overrides
Section titled “Overrides”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”subSet()
Section titled “subSet()”Call Signature
Section titled “Call Signature”subSet(
fromElement,toElement):SortedSet<E>
Defined in: src/interfaces/Set.ts:126
Returns a live view of the elements from fromElement (inclusive) to toElement (exclusive); same as
subSet(fromElement, true, toElement, false).
Parameters
Section titled “Parameters”fromElement
Section titled “fromElement”E
toElement
Section titled “toElement”E
Returns
Section titled “Returns”SortedSet<E>
Throws
Section titled “Throws”IllegalArgumentException if fromElement is greater than toElement, or either is outside this
view’s range
Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”subSet(
fromElement,fromInclusive,toElement,toInclusive):NavigableSet<E>
Defined in: src/interfaces/Set.ts:133
Returns a live view of the elements between fromElement and toElement, each end included when its flag is set.
Parameters
Section titled “Parameters”fromElement
Section titled “fromElement”E
fromInclusive
Section titled “fromInclusive”boolean
toElement
Section titled “toElement”E
toInclusive
Section titled “toInclusive”boolean
Returns
Section titled “Returns”NavigableSet<E>
Throws
Section titled “Throws”IllegalArgumentException if fromElement is greater than toElement, or either is outside this
view’s range
Throws
Section titled “Throws”NullPointerException if either bound is null and this set rejects null
Overrides
Section titled “Overrides”SortedSet.subSet
tailSet()
Section titled “tailSet()”Call Signature
Section titled “Call Signature”tailSet(
fromElement):SortedSet<E>
Defined in: src/interfaces/Set.ts:113
Returns a live view of the elements greater than or equal to fromElement; same as tailSet(fromElement, true).
Parameters
Section titled “Parameters”fromElement
Section titled “fromElement”E
Returns
Section titled “Returns”SortedSet<E>
Throws
Section titled “Throws”IllegalArgumentException if this set is itself a range view and fromElement is outside its range
Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”tailSet(
fromElement,inclusive):NavigableSet<E>
Defined in: src/interfaces/Set.ts:119
Returns a live view of the elements greater than (or, if inclusive, equal to) fromElement.
Parameters
Section titled “Parameters”fromElement
Section titled “fromElement”E
inclusive
Section titled “inclusive”boolean
Returns
Section titled “Returns”NavigableSet<E>
Throws
Section titled “Throws”IllegalArgumentException if this set is itself a range view and fromElement is outside its range
Throws
Section titled “Throws”NullPointerException if fromElement is null and this set rejects null
Overrides
Section titled “Overrides”SortedSet.tailSet
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