Skip to content
Buy me a coffee

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.

E

[iterator](): Iterator<E, any, any>

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:47

Iterator<E, any, any>

SortedSet.[iterator]


add(e): boolean

Defined in: src/interfaces/Collection.ts:54

Ensures this collection contains e.

E

boolean

true if the collection changed (a set returns false for a duplicate)

UnsupportedOperationException if this collection is unmodifiable

NullPointerException if e is null and this collection rejects null

IllegalArgumentException if some property of e prevents adding it (for example a key outside a sorted view’s range)

IllegalStateException if a capacity-bounded queue is full

SortedSet.add


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.

Collection<E>

boolean

true if this collection changed

NullPointerException if c is null, or contains null and this collection rejects null

UnsupportedOperationException if this collection is unmodifiable

SortedSet.addAll


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).

E

void

UnsupportedOperationException if this collection is unmodifiable or sorted

NullPointerException if e is null and this collection rejects null

SortedSet.addFirst


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).

E

void

UnsupportedOperationException if this collection is unmodifiable or sorted

NullPointerException if e is null and this collection rejects null

SortedSet.addLast


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.

E

E | null

NullPointerException if e is null and this set rejects null


clear(): void

Defined in: src/interfaces/Collection.ts:99

Removes all elements.

void

UnsupportedOperationException if this collection is unmodifiable

SortedSet.clear


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.

Comparator<E> | null

SortedSet.comparator


contains(o): boolean

Defined in: src/interfaces/Collection.ts:37

Returns true if this collection contains an element equal to o (by Objects.equals).

unknown

boolean

NullPointerException if o is null and this collection rejects null (for example the immutable collections and sorted collections with natural ordering)

SortedSet.contains


containsAll(c): boolean

Defined in: src/interfaces/Collection.ts:66

Returns true if this collection contains every element of c.

Collection<unknown>

boolean

NullPointerException if c is null

SortedSet.containsAll


descendingIterator(): Iterator<E>

Defined in: src/interfaces/Set.ts:97

Returns a fail-fast iterator over the elements in descending order.

Iterator<E>


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.

NavigableSet<E>


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.

unknown

boolean

SortedSet.equals


first(): E

Defined in: src/interfaces/Set.ts:36

Returns the lowest element.

E

NoSuchElementException if this set is empty

SortedSet.first


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.

E

E | null

NullPointerException if e is null and this set rejects null


forEach(action): void

Defined in: src/interfaces/Collection.ts:27

Calls action for each element, in iteration order.

(e) => void

void

NullPointerException if action is null

ConcurrentModificationException if action structurally modifies this collection

SortedSet.forEach


getFirst(): E

Defined in: src/interfaces/Collection.ts:144

Returns the first element.

E

NoSuchElementException if this collection is empty

SortedSet.getFirst


getLast(): E

Defined in: src/interfaces/Collection.ts:149

Returns the last element.

E

NoSuchElementException if this collection is empty

SortedSet.getLast


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.

number

SortedSet.hashCode


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).

E

SortedSet<E>

IllegalArgumentException if this set is itself a range view and toElement is outside its range

SortedSet.headSet

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.

E

boolean

NavigableSet<E>

IllegalArgumentException if this set is itself a range view and toElement is outside its range

NullPointerException if toElement is null and this set rejects null

SortedSet.headSet


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.

E

E | null

NullPointerException if e is null and this set rejects null


isEmpty(): boolean

Defined in: src/interfaces/Collection.ts:31

Returns true if this collection has no elements.

boolean

SortedSet.isEmpty


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.

Iterator<E>

SortedSet.iterator


last(): E

Defined in: src/interfaces/Set.ts:41

Returns the highest element.

E

NoSuchElementException if this set is empty

SortedSet.last


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.

E

E | null

NullPointerException if e is null and this set rejects null


parallelStream(): Stream<E>

Defined in: src/interfaces/Collection.ts:118

Returns a stream flagged as parallel; it is evaluated sequentially (JS is single-threaded).

Stream<E>

SortedSet.parallelStream


pollFirst(): E | null

Defined in: src/interfaces/Set.ts:91

Removes and returns the lowest element, or null if this set is empty.

E | null


pollLast(): E | null

Defined in: src/interfaces/Set.ts:93

Removes and returns the highest element, or null if this set is empty.

E | null


remove(o): boolean

Defined in: src/interfaces/Collection.ts:61

Removes one element equal to o, if present.

unknown

boolean

true if an element was removed

UnsupportedOperationException if this collection is unmodifiable

NullPointerException if o is null and this collection rejects null

SortedSet.remove


removeAll(c): boolean

Defined in: src/interfaces/Collection.ts:80

Removes every element that is also contained in c.

Collection<unknown>

boolean

true if this collection changed

NullPointerException if c is null

UnsupportedOperationException if this collection is unmodifiable

SortedSet.removeAll


removeFirst(): E

Defined in: src/interfaces/Collection.ts:155

Removes and returns the first element.

E

NoSuchElementException if this collection is empty

UnsupportedOperationException if this collection is unmodifiable

SortedSet.removeFirst


removeIf(filter): boolean

Defined in: src/interfaces/Collection.ts:87

Removes every element for which filter returns true.

(e) => boolean

boolean

true if any element was removed

NullPointerException if filter is null

UnsupportedOperationException if this collection is unmodifiable and an element matches

SortedSet.removeIf


removeLast(): E

Defined in: src/interfaces/Collection.ts:161

Removes and returns the last element.

E

NoSuchElementException if this collection is empty

UnsupportedOperationException if this collection is unmodifiable

SortedSet.removeLast


retainAll(c): boolean

Defined in: src/interfaces/Collection.ts:94

Keeps only the elements that are also contained in c, removing all others.

Collection<unknown>

boolean

true if this collection changed

NullPointerException if c is null

UnsupportedOperationException if this collection is unmodifiable

SortedSet.retainAll


reversed(): NavigableSet<E>

Defined in: src/interfaces/Set.ts:135

Returns a live descending view; same as descendingSet().

NavigableSet<E>

SortedSet.reversed


size(): number

Defined in: src/interfaces/Collection.ts:29

Returns the number of elements.

number

SortedSet.size


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.

Spliterator<E>

SortedSet.spliterator


stream(): Stream<E>

Defined in: src/interfaces/Collection.ts:116

Returns a sequential stream over this collection.

Stream<E>

SortedSet.stream


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).

E

E

SortedSet<E>

IllegalArgumentException if fromElement is greater than toElement, or either is outside this view’s range

SortedSet.subSet

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.

E

boolean

E

boolean

NavigableSet<E>

IllegalArgumentException if fromElement is greater than toElement, or either is outside this view’s range

NullPointerException if either bound is null and this set rejects null

SortedSet.subSet


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).

E

SortedSet<E>

IllegalArgumentException if this set is itself a range view and fromElement is outside its range

SortedSet.tailSet

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.

E

boolean

NavigableSet<E>

IllegalArgumentException if this set is itself a range view and fromElement is outside its range

NullPointerException if fromElement is null and this set rejects null

SortedSet.tailSet


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.

E[]

SortedSet.toArray

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).

A extends WritableArrayLike<E>

(length) => A

creates the target array for a given length

A

SortedSet.toArray


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).

string

SortedSet.toString