Skip to content
Buy me a coffee

SortedMap

Defined in: src/interfaces/Map.ts:215

A map whose keys are kept in ascending order by natural ordering or a comparator, which alone decides key equality. putFirst/putLast throw UnsupportedOperationException. With natural ordering, null keys throw NullPointerException and keys with no natural order throw ClassCastException. Range views are live and reject putting a key outside their range with IllegalArgumentException.

K

V

[iterator](): Iterator<[K, V], any, any>

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

Iterator<[K, V], any, any>

SequencedMap.[iterator]


clear(): void

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

Removes all mappings.

void

UnsupportedOperationException if this map is unmodifiable

SequencedMap.clear


comparator(): Comparator<K> | null

Defined in: src/interfaces/Map.ts:217

Returns the comparator that orders the keys, or null when natural ordering is used.

Comparator<K> | null


compute(key, fn): V | null

Defined in: src/interfaces/Map.ts:163

Stores fn(key, current), where current is the mapped value or null; a null/undefined result removes the mapping (or leaves the key absent).

K

(key, value) => V | null | undefined

V | null

the new value, or null if there is now no mapping

NullPointerException if fn is null

ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)

SequencedMap.compute


computeIfAbsent(key, fn): V | null

Defined in: src/interfaces/Map.ts:148

If key is absent or mapped to null, stores fn(key) unless that is null/undefined (then nothing is stored).

K

(key) => V | null | undefined

V | null

the existing non-null value, the newly stored value, or null

NullPointerException if fn is null

ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)

SequencedMap.computeIfAbsent


computeIfPresent(key, fn): V | null

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

If key has a non-null value, replaces it with fn(key, value); a null/undefined result removes the mapping.

K

(key, value) => V | null | undefined

V | null

the new value, or null if the key was absent or has been removed

NullPointerException if fn is null

ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)

SequencedMap.computeIfPresent


containsKey(key): boolean

Defined in: src/interfaces/Map.ts:49

Returns true if this map has a mapping for key, even if it maps to null.

unknown

boolean

NullPointerException if key is null and this map rejects null keys

SequencedMap.containsKey


containsValue(value): boolean

Defined in: src/interfaces/Map.ts:51

Returns true if one or more keys map to a value equal to value. Usually O(n).

unknown

boolean

SequencedMap.containsValue


entrySet(): Set<MapEntry<K, V>>

Defined in: src/interfaces/Map.ts:102

Returns a live view of the mappings. Its entries are live (setValue writes through), removing from it removes the mapping, and it does not support add (UnsupportedOperationException).

Set<MapEntry<K, V>>

SequencedMap.entrySet


equals(o): boolean

Defined in: src/interfaces/Map.ts:104

Returns true if o is a map with the same mappings, whatever its class.

unknown

boolean

SequencedMap.equals


firstEntry(): MapEntry<K, V> | null

Defined in: src/interfaces/Map.ts:182

Returns the first entry as an immutable snapshot, or null if this map is empty.

MapEntry<K, V> | null

SequencedMap.firstEntry


firstKey(): K

Defined in: src/interfaces/Map.ts:222

Returns the lowest key.

K

NoSuchElementException if this map is empty


forEach(action): void

Defined in: src/interfaces/Map.ts:119

Calls action for each mapping, in iteration order.

(key, value) => void

void

NullPointerException if action is null

ConcurrentModificationException if action structurally modifies this map

SequencedMap.forEach


get(key): V | null

Defined in: src/interfaces/Map.ts:56

Returns the value mapped to key, or null if there is none (or the key maps to null).

unknown

V | null

NullPointerException if key is null and this map rejects null keys

SequencedMap.get


getOrDefault(key, defaultValue): V

Defined in: src/interfaces/Map.ts:111

Returns the value mapped to key, or defaultValue if there is no mapping. A key mapped to null returns null.

unknown

V

V

SequencedMap.getOrDefault

getOrDefault(key, defaultValue): V | null

Defined in: src/interfaces/Map.ts:113

Returns the value mapped to key, or defaultValue (here possibly null) if there is no mapping.

unknown

V | null

V | null

SequencedMap.getOrDefault


hashCode(): number

Defined in: src/interfaces/Map.ts:106

Returns the sum over all entries of hash(key) ^ hash(value), in 32-bit arithmetic.

number

SequencedMap.hashCode


headMap(toKey): SortedMap<K, V>

Defined in: src/interfaces/Map.ts:233

Returns a live view of the mappings whose keys are strictly less than toKey.

K

SortedMap<K, V>

IllegalArgumentException if this map is itself a range view and toKey is outside its range

NullPointerException if toKey is null and this map rejects null keys


isEmpty(): boolean

Defined in: src/interfaces/Map.ts:44

Returns true if this map has no mappings.

boolean

SequencedMap.isEmpty


keySet(): Set<K>

Defined in: src/interfaces/Map.ts:92

Returns a live view of the keys. Removing from it removes the mapping; it does not support add (UnsupportedOperationException).

Set<K>

SequencedMap.keySet


lastEntry(): MapEntry<K, V> | null

Defined in: src/interfaces/Map.ts:184

Returns the last entry as an immutable snapshot, or null if this map is empty.

MapEntry<K, V> | null

SequencedMap.lastEntry


lastKey(): K

Defined in: src/interfaces/Map.ts:227

Returns the highest key.

K

NoSuchElementException if this map is empty


merge(key, value, fn): V | null

Defined in: src/interfaces/Map.ts:171

If key is absent or mapped to null, maps it to value; otherwise stores fn(oldValue, value), and a null/undefined result removes the mapping. merge(k, 1, (a, b) => a + b) counts occurrences.

K

V

(oldValue, value) => V | null | undefined

V | null

the new value, or null if the mapping was removed

NullPointerException if value or fn is null

ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)

SequencedMap.merge


pollFirstEntry(): MapEntry<K, V> | null

Defined in: src/interfaces/Map.ts:186

Removes and returns the first entry as an immutable snapshot, or null if this map is empty.

MapEntry<K, V> | null

SequencedMap.pollFirstEntry


pollLastEntry(): MapEntry<K, V> | null

Defined in: src/interfaces/Map.ts:188

Removes and returns the last entry as an immutable snapshot, or null if this map is empty.

MapEntry<K, V> | null

SequencedMap.pollLastEntry


put(key, value): V | null

Defined in: src/interfaces/Map.ts:64

Maps key to value, replacing any previous value.

K

V

V | null

the previous value, or null if there was no mapping

UnsupportedOperationException if this map is unmodifiable

NullPointerException if key or value is null and this map rejects it

IllegalArgumentException if key is outside the range of a sorted map view

SequencedMap.put


putAll(m): void

Defined in: src/interfaces/Map.ts:82

Copies every mapping of m into this map, as put would.

Map<K, V>

void

NullPointerException if m is null

UnsupportedOperationException if this map is unmodifiable

SequencedMap.putAll


putFirst(key, value): V | null

Defined in: src/interfaces/Map.ts:194

Maps key to value and moves the mapping to the front.

K

V

V | null

the previous value, or null if there was no mapping

UnsupportedOperationException if this map is sorted or unmodifiable

SequencedMap.putFirst


putIfAbsent(key, value): V | null

Defined in: src/interfaces/Map.ts:131

Maps key to value if it is absent or mapped to null.

K

V

V | null

the current value if it was non-null (and nothing changed), otherwise null

UnsupportedOperationException if this map is unmodifiable

SequencedMap.putIfAbsent


putLast(key, value): V | null

Defined in: src/interfaces/Map.ts:200

Maps key to value and moves the mapping to the end.

K

V

V | null

the previous value, or null if there was no mapping

UnsupportedOperationException if this map is sorted or unmodifiable

SequencedMap.putLast


remove(key): V | null

Defined in: src/interfaces/Map.ts:70

Removes the mapping for key, if present.

unknown

V | null

the removed value, or null if there was no mapping

UnsupportedOperationException if this map is unmodifiable

SequencedMap.remove

remove(key, value): boolean

Defined in: src/interfaces/Map.ts:76

Removes the mapping for key only if it is currently mapped to a value equal to value.

unknown

unknown

boolean

true if the mapping was removed

UnsupportedOperationException if this map is unmodifiable

SequencedMap.remove


replace(key, value): V | null

Defined in: src/interfaces/Map.ts:136

Replaces the value for key only if key currently has a mapping (even to null).

K

V

V | null

the previous value, or null if there was no mapping

SequencedMap.replace

replace(key, oldValue, newValue): boolean

Defined in: src/interfaces/Map.ts:141

Replaces the value for key with newValue only if it is currently mapped to a value equal to oldValue.

K

V

V

boolean

true if the value was replaced

SequencedMap.replace


replaceAll(fn): void

Defined in: src/interfaces/Map.ts:125

Replaces each value with fn(key, value), in iteration order.

(key, value) => V

void

NullPointerException if fn is null, or it returns null and this map rejects null values

UnsupportedOperationException if this map is unmodifiable

SequencedMap.replaceAll


reversed(): SortedMap<K, V>

Defined in: src/interfaces/Map.ts:247

Returns a live descending view: changes through either side are visible in the other.

SortedMap<K, V>

SequencedMap.reversed


sequencedEntrySet(): SequencedSet<MapEntry<K, V>>

Defined in: src/interfaces/Map.ts:206

Returns a live, sequenced view of the mappings.

SequencedSet<MapEntry<K, V>>

SequencedMap.sequencedEntrySet


sequencedKeySet(): SequencedSet<K>

Defined in: src/interfaces/Map.ts:202

Returns a live, sequenced view of the keys.

SequencedSet<K>

SequencedMap.sequencedKeySet


sequencedValues(): SequencedCollection<V>

Defined in: src/interfaces/Map.ts:204

Returns a live, sequenced view of the values.

SequencedCollection<V>

SequencedMap.sequencedValues


size(): number

Defined in: src/interfaces/Map.ts:42

Returns the number of mappings.

number

SequencedMap.size


subMap(fromKey, toKey): SortedMap<K, V>

Defined in: src/interfaces/Map.ts:245

Returns a live view of the mappings with keys from fromKey (inclusive) to toKey (exclusive).

K

K

SortedMap<K, V>

IllegalArgumentException if fromKey is greater than toKey, or either is outside this view’s range

NullPointerException if either bound is null and this map rejects null keys


tailMap(fromKey): SortedMap<K, V>

Defined in: src/interfaces/Map.ts:239

Returns a live view of the mappings whose keys are greater than or equal to fromKey.

K

SortedMap<K, V>

IllegalArgumentException if this map is itself a range view and fromKey is outside its range

NullPointerException if fromKey is null and this map rejects null keys


toString(): string

Defined in: src/interfaces/Map.ts:108

Returns the mappings in iteration order as {k1=v1, k2=v2}; a key or value that is this map prints as (this Map).

string

SequencedMap.toString


values(): Collection<V>

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

Returns a live view of the values. Removing from it removes the mapping; it does not support add (UnsupportedOperationException).

Collection<V>

SequencedMap.values