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.
Extends
Section titled “Extends”SequencedMap<K,V>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”K
V
Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<[K,V],any,any>
Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:47
Returns
Section titled “Returns”Iterator<[K, V], any, any>
Inherited from
Section titled “Inherited from”clear()
Section titled “clear()”clear():
void
Defined in: src/interfaces/Map.ts:87
Removes all mappings.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”comparator()
Section titled “comparator()”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.
Returns
Section titled “Returns”Comparator<K> | null
compute()
Section titled “compute()”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).
Parameters
Section titled “Parameters”K
(key, value) => V | null | undefined
Returns
Section titled “Returns”V | null
the new value, or null if there is now no mapping
Throws
Section titled “Throws”NullPointerException if fn is null
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)
Inherited from
Section titled “Inherited from”computeIfAbsent()
Section titled “computeIfAbsent()”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).
Parameters
Section titled “Parameters”K
(key) => V | null | undefined
Returns
Section titled “Returns”V | null
the existing non-null value, the newly stored value, or null
Throws
Section titled “Throws”NullPointerException if fn is null
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)
Inherited from
Section titled “Inherited from”computeIfPresent()
Section titled “computeIfPresent()”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.
Parameters
Section titled “Parameters”K
(key, value) => V | null | undefined
Returns
Section titled “Returns”V | null
the new value, or null if the key was absent or has been removed
Throws
Section titled “Throws”NullPointerException if fn is null
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)
Inherited from
Section titled “Inherited from”containsKey()
Section titled “containsKey()”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.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if key is null and this map rejects null keys
Inherited from
Section titled “Inherited from”containsValue()
Section titled “containsValue()”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).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”entrySet()
Section titled “entrySet()”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).
Returns
Section titled “Returns”Set<MapEntry<K, V>>
Inherited from
Section titled “Inherited from”equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/interfaces/Map.ts:104
Returns true if o is a map with the same mappings, whatever its class.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”firstEntry()
Section titled “firstEntry()”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.
Returns
Section titled “Returns”MapEntry<K, V> | null
Inherited from
Section titled “Inherited from”firstKey()
Section titled “firstKey()”firstKey():
K
Defined in: src/interfaces/Map.ts:222
Returns the lowest key.
Returns
Section titled “Returns”K
Throws
Section titled “Throws”NoSuchElementException if this map is empty
forEach()
Section titled “forEach()”forEach(
action):void
Defined in: src/interfaces/Map.ts:119
Calls action for each mapping, in iteration order.
Parameters
Section titled “Parameters”action
Section titled “action”(key, value) => 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 map
Inherited from
Section titled “Inherited from”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).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”V | null
Throws
Section titled “Throws”NullPointerException if key is null and this map rejects null keys
Inherited from
Section titled “Inherited from”getOrDefault()
Section titled “getOrDefault()”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”unknown
defaultValue
Section titled “defaultValue”V
Returns
Section titled “Returns”V
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”unknown
defaultValue
Section titled “defaultValue”V | null
Returns
Section titled “Returns”V | null
Inherited from
Section titled “Inherited from”hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/interfaces/Map.ts:106
Returns the sum over all entries of hash(key) ^ hash(value), in 32-bit arithmetic.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”headMap()
Section titled “headMap()”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.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”SortedMap<K, V>
Throws
Section titled “Throws”IllegalArgumentException if this map is itself a range view and toKey is outside its range
Throws
Section titled “Throws”NullPointerException if toKey is null and this map rejects null keys
isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/interfaces/Map.ts:44
Returns true if this map has no mappings.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”keySet()
Section titled “keySet()”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).
Returns
Section titled “Returns”Set<K>
Inherited from
Section titled “Inherited from”lastEntry()
Section titled “lastEntry()”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.
Returns
Section titled “Returns”MapEntry<K, V> | null
Inherited from
Section titled “Inherited from”lastKey()
Section titled “lastKey()”lastKey():
K
Defined in: src/interfaces/Map.ts:227
Returns the highest key.
Returns
Section titled “Returns”K
Throws
Section titled “Throws”NoSuchElementException if this map is empty
merge()
Section titled “merge()”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.
Parameters
Section titled “Parameters”K
V
(oldValue, value) => V | null | undefined
Returns
Section titled “Returns”V | null
the new value, or null if the mapping was removed
Throws
Section titled “Throws”NullPointerException if value or fn is null
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map (hashed and tree maps detect it)
Inherited from
Section titled “Inherited from”pollFirstEntry()
Section titled “pollFirstEntry()”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.
Returns
Section titled “Returns”MapEntry<K, V> | null
Inherited from
Section titled “Inherited from”pollLastEntry()
Section titled “pollLastEntry()”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.
Returns
Section titled “Returns”MapEntry<K, V> | null
Inherited from
Section titled “Inherited from”put(
key,value):V|null
Defined in: src/interfaces/Map.ts:64
Maps key to value, replacing any previous value.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
the previous value, or null if there was no mapping
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Throws
Section titled “Throws”NullPointerException if key or value is null and this map rejects it
Throws
Section titled “Throws”IllegalArgumentException if key is outside the range of a sorted map view
Inherited from
Section titled “Inherited from”putAll()
Section titled “putAll()”putAll(
m):void
Defined in: src/interfaces/Map.ts:82
Copies every mapping of m into this map, as put would.
Parameters
Section titled “Parameters”Map<K, V>
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if m is null
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”putFirst()
Section titled “putFirst()”putFirst(
key,value):V|null
Defined in: src/interfaces/Map.ts:194
Maps key to value and moves the mapping to the front.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
the previous value, or null if there was no mapping
Throws
Section titled “Throws”UnsupportedOperationException if this map is sorted or unmodifiable
Inherited from
Section titled “Inherited from”putIfAbsent()
Section titled “putIfAbsent()”putIfAbsent(
key,value):V|null
Defined in: src/interfaces/Map.ts:131
Maps key to value if it is absent or mapped to null.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
the current value if it was non-null (and nothing changed), otherwise null
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”putLast()
Section titled “putLast()”putLast(
key,value):V|null
Defined in: src/interfaces/Map.ts:200
Maps key to value and moves the mapping to the end.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
the previous value, or null if there was no mapping
Throws
Section titled “Throws”UnsupportedOperationException if this map is sorted or unmodifiable
Inherited from
Section titled “Inherited from”remove()
Section titled “remove()”Call Signature
Section titled “Call Signature”remove(
key):V|null
Defined in: src/interfaces/Map.ts:70
Removes the mapping for key, if present.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”V | null
the removed value, or null if there was no mapping
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”unknown
unknown
Returns
Section titled “Returns”boolean
true if the mapping was removed
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”replace()
Section titled “replace()”Call Signature
Section titled “Call Signature”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).
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
the previous value, or null if there was no mapping
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”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.
Parameters
Section titled “Parameters”K
oldValue
Section titled “oldValue”V
newValue
Section titled “newValue”V
Returns
Section titled “Returns”boolean
true if the value was replaced
Inherited from
Section titled “Inherited from”replaceAll()
Section titled “replaceAll()”replaceAll(
fn):void
Defined in: src/interfaces/Map.ts:125
Replaces each value with fn(key, value), in iteration order.
Parameters
Section titled “Parameters”(key, value) => V
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if fn is null, or it returns null and this map rejects null values
Throws
Section titled “Throws”UnsupportedOperationException if this map is unmodifiable
Inherited from
Section titled “Inherited from”reversed()
Section titled “reversed()”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.
Returns
Section titled “Returns”SortedMap<K, V>
Overrides
Section titled “Overrides”sequencedEntrySet()
Section titled “sequencedEntrySet()”sequencedEntrySet():
SequencedSet<MapEntry<K,V>>
Defined in: src/interfaces/Map.ts:206
Returns a live, sequenced view of the mappings.
Returns
Section titled “Returns”SequencedSet<MapEntry<K, V>>
Inherited from
Section titled “Inherited from”SequencedMap.sequencedEntrySet
sequencedKeySet()
Section titled “sequencedKeySet()”sequencedKeySet():
SequencedSet<K>
Defined in: src/interfaces/Map.ts:202
Returns a live, sequenced view of the keys.
Returns
Section titled “Returns”SequencedSet<K>
Inherited from
Section titled “Inherited from”sequencedValues()
Section titled “sequencedValues()”sequencedValues():
SequencedCollection<V>
Defined in: src/interfaces/Map.ts:204
Returns a live, sequenced view of the values.
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”size()
Section titled “size()”size():
number
Defined in: src/interfaces/Map.ts:42
Returns the number of mappings.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”subMap()
Section titled “subMap()”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).
Parameters
Section titled “Parameters”fromKey
Section titled “fromKey”K
K
Returns
Section titled “Returns”SortedMap<K, V>
Throws
Section titled “Throws”IllegalArgumentException if fromKey is greater than toKey, or either is outside this view’s range
Throws
Section titled “Throws”NullPointerException if either bound is null and this map rejects null keys
tailMap()
Section titled “tailMap()”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.
Parameters
Section titled “Parameters”fromKey
Section titled “fromKey”K
Returns
Section titled “Returns”SortedMap<K, V>
Throws
Section titled “Throws”IllegalArgumentException if this map is itself a range view and fromKey is outside its range
Throws
Section titled “Throws”NullPointerException if fromKey is null and this map rejects null keys
toString()
Section titled “toString()”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).
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”values()
Section titled “values()”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).
Returns
Section titled “Returns”Collection<V>