TreeMap
Defined in: src/map/TreeMap.ts:231
A NavigableMap stored in a red-black tree, sorted by key. Keys are ordered by the comparator given to the
constructor, or naturally (numbers, strings, bigints, booleans, Dates, objects with compareTo) when there is
none; the ordering, not equals(), decides which keys are equal.
get, put, remove, containsKey and every navigation method run in O(log n); lastKey is O(1) (the maximum
is cached) and putting a key above the maximum finds its slot in O(1). Iteration is in key order. Under natural
ordering null/undefined keys throw NullPointerException and keys of mixed types throw
ClassCastException; a comparator may accept them. Values may be null. Views and iterators are live and
fail-fast.
Extends
Section titled “Extends”AbstractMap<K,V>
Type Parameters
Section titled “Type Parameters”K
V
Implements
Section titled “Implements”NavigableMap<K,V>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TreeMap<
K,V>(source?):TreeMap<K,V>
Defined in: src/map/TreeMap.ts:252
Creates an empty map, an empty map ordered by a comparator, or a copy of a map. With no argument (or null)
keys are ordered naturally. A SortedMap source (anything with a comparator() method) keeps its
comparator and order; any other Map source is ordered naturally. One signature covers all forms.
Parameters
Section titled “Parameters”source?
Section titled “source?”Map<K, V> | Comparator<K> | null
a comparator, a map to copy, or nothing for natural ordering
Returns
Section titled “Returns”TreeMap<K, V>
Throws
Section titled “Throws”IllegalArgumentException if source is neither a comparator nor a map
Throws
Section titled “Throws”NullPointerException / ClassCastException if a copied key cannot be compared
Overrides
Section titled “Overrides”Methods
Section titled “Methods”[INSPECT]()
Section titled “[INSPECT]()”[INSPECT]():
string
Defined in: src/abstract/AbstractMap.ts:187
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<[K,V]>
Defined in: src/map/TreeMap.ts:918
Returns a fail-fast iterator over the mappings as [key, value] pairs, in ascending key order.
Returns
Section titled “Returns”IterableIterator<[K, V]>
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”ceilingEntry()
Section titled “ceilingEntry()”ceilingEntry(
key):MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1186
Returns the entry with the least key greater than or equal to key (an immutable snapshot), or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”MapEntry<K, V> | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”ceilingKey()
Section titled “ceilingKey()”ceilingKey(
key):K|null
Defined in: src/map/TreeMap.ts:1194
Returns the least key greater than or equal to key, or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”K | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: src/map/TreeMap.ts:798
Removes all mappings. O(1).
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”clone()
Section titled “clone()”clone():
TreeMap<K,V>
Defined in: src/map/TreeMap.ts:266
Shallow copy of the same runtime class (subclass fields included) with the same comparator.
Returns
Section titled “Returns”TreeMap<K, V>
comparator()
Section titled “comparator()”comparator():
Comparator<K> |null
Defined in: src/map/TreeMap.ts:1079
Returns the comparator that orders the keys, or null when natural ordering is used.
Returns
Section titled “Returns”Comparator<K> | null
Implementation of
Section titled “Implementation of”compute()
Section titled “compute()”compute(
key,fn):V|null
Defined in: src/map/TreeMap.ts:879
Stores fn(key, current), where current is the mapped value or null; a null/undefined result removes the
mapping (or leaves the key absent). O(log n) plus the cost of fn.
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, or key is null under natural ordering and must be
compared or stored
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”computeIfAbsent()
Section titled “computeIfAbsent()”computeIfAbsent(
key,fn):V|null
Defined in: src/map/TreeMap.ts:840
If key is absent or mapped to null, stores fn(key) unless that is null/undefined (then nothing is
stored). O(log n) plus the cost of fn.
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, or key is null under natural ordering and must be
compared or stored
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”computeIfPresent()
Section titled “computeIfPresent()”computeIfPresent(
key,fn):V|null
Defined in: src/map/TreeMap.ts:861
If key has a non-null value, replaces it with fn(key, value); a null/undefined result removes the mapping.
O(log n) plus the cost of fn.
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, or key is null or undefined under natural ordering
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”containsKey()
Section titled “containsKey()”containsKey(
key):boolean
Defined in: src/map/TreeMap.ts:724
Returns true if this map has a mapping for key, even if it maps to null. O(log n); keys are matched by the
ordering, not equals().
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering
Throws
Section titled “Throws”ClassCastException if key cannot be compared with the keys in this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”containsValue()
Section titled “containsValue()”containsValue(
value):boolean
Defined in: src/map/TreeMap.ts:729
Returns true if one or more keys map to a value equal to value. O(n), scanning values in key order.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”descendingKeySet()
Section titled “descendingKeySet()”descendingKeySet():
NavigableSet<K>
Defined in: src/map/TreeMap.ts:981
Returns a live, descending view of the keys. Removing from it removes the mapping; add throws
UnsupportedOperationException.
Returns
Section titled “Returns”NavigableSet<K>
Implementation of
Section titled “Implementation of”descendingMap()
Section titled “descendingMap()”descendingMap():
NavigableMap<K,V>
Defined in: src/map/TreeMap.ts:989
Returns a live view of this map in descending key order: changes through either side are visible in the other. Created once and cached.
Returns
Section titled “Returns”NavigableMap<K, V>
Implementation of
Section titled “Implementation of”entrySet()
Section titled “entrySet()”entrySet():
SequencedSet<MapEntry<K,V>>
Defined in: src/map/TreeMap.ts:949
Returns a live view of the mappings in ascending key order. Entries from its iterator write through with
setValue; removing from it removes the mapping, and it does not support add (UnsupportedOperationException).
Returns
Section titled “Returns”SequencedSet<MapEntry<K, V>>
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/abstract/AbstractMap.ts:158
Returns true if o is a Map with the same mappings (any Map implementation). A
ClassCastException or NullPointerException from o’s lookups counts as “not equal”.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”firstEntry()
Section titled “firstEntry()”firstEntry():
MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1100
Returns the entry with the lowest key as an immutable snapshot, or null if this map is empty. O(log n).
Returns
Section titled “Returns”MapEntry<K, V> | null
Implementation of
Section titled “Implementation of”firstKey()
Section titled “firstKey()”firstKey():
K
Defined in: src/map/TreeMap.ts:1087
Returns the lowest key. O(log n).
Returns
Section titled “Returns”K
Throws
Section titled “Throws”NoSuchElementException if this map is empty
Implementation of
Section titled “Implementation of”floorEntry()
Section titled “floorEntry()”floorEntry(
key):MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1170
Returns the entry with the greatest key less than or equal to key (an immutable snapshot), or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”MapEntry<K, V> | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”floorKey()
Section titled “floorKey()”floorKey(
key):K|null
Defined in: src/map/TreeMap.ts:1178
Returns the greatest key less than or equal to key, or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”K | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”forEach()
Section titled “forEach()”forEach(
action):void
Defined in: src/map/TreeMap.ts:809
Calls action for each mapping, in ascending key 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
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”get(
key):V|null
Defined in: src/map/TreeMap.ts:713
Returns the value mapped to key, or null if there is none (or the key maps to null). O(log n).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”V | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering
Throws
Section titled “Throws”ClassCastException if key cannot be compared with the keys in this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”getOrDefault()
Section titled “getOrDefault()”Call Signature
Section titled “Call Signature”getOrDefault(
key,defaultValue):V
Defined in: src/map/TreeMap.ts:739
Returns the value mapped to key, or defaultValue if there is no mapping. A key mapped to null returns null.
O(log n).
Parameters
Section titled “Parameters”unknown
defaultValue
Section titled “defaultValue”V
Returns
Section titled “Returns”V
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”getOrDefault(
key,defaultValue):V|null
Defined in: src/map/TreeMap.ts:745
Returns the value mapped to key, or defaultValue (here possibly null) if there is no mapping. O(log n).
Parameters
Section titled “Parameters”unknown
defaultValue
Section titled “defaultValue”V | null
Returns
Section titled “Returns”V | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/abstract/AbstractMap.ts:179
Returns the sum of hashCode(key) ^ hashCode(value) over the mappings, so equal maps hash the same.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”headMap()
Section titled “headMap()”Call Signature
Section titled “Call Signature”headMap(
toKey):SortedMap<K,V>
Defined in: src/map/TreeMap.ts:1028
Returns a live view of the mappings whose keys are strictly less than toKey; same as headMap(toKey, false).
O(1) to create, O(log n) per operation; putting a key outside the range through the view throws
IllegalArgumentException.
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”SortedMap<K, V>
Throws
Section titled “Throws”NullPointerException if toKey is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Call Signature
Section titled “Call Signature”headMap(
toKey,inclusive):NavigableMap<K,V>
Defined in: src/map/TreeMap.ts:1034
Returns a live view of the mappings whose keys are less than (or, if inclusive, equal to) toKey. O(1) to
create.
Parameters
Section titled “Parameters”K
inclusive
Section titled “inclusive”boolean
Returns
Section titled “Returns”NavigableMap<K, V>
Throws
Section titled “Throws”NullPointerException if toKey is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”higherEntry()
Section titled “higherEntry()”higherEntry(
key):MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1202
Returns the entry with the least key strictly greater than key (an immutable snapshot), or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”MapEntry<K, V> | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”higherKey()
Section titled “higherKey()”higherKey(
key):K|null
Defined in: src/map/TreeMap.ts:1210
Returns the least key strictly greater than key, or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”K | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/map/TreeMap.ts:700
Returns true if this map has no mappings. O(1).
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”keySet()
Section titled “keySet()”keySet():
NavigableSet<K>
Defined in: src/map/TreeMap.ts:957
Returns a live, ascending view of the keys; same as navigableKeySet(). Removing from it removes the mapping; it
does not support add (UnsupportedOperationException).
Returns
Section titled “Returns”NavigableSet<K>
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”lastEntry()
Section titled “lastEntry()”lastEntry():
MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1105
Returns the entry with the highest key as an immutable snapshot, or null if this map is empty. O(1).
Returns
Section titled “Returns”MapEntry<K, V> | null
Implementation of
Section titled “Implementation of”lastKey()
Section titled “lastKey()”lastKey():
K
Defined in: src/map/TreeMap.ts:1095
Returns the highest key. O(1): the maximum is cached.
Returns
Section titled “Returns”K
Throws
Section titled “Throws”NoSuchElementException if this map is empty
Implementation of
Section titled “Implementation of”lowerEntry()
Section titled “lowerEntry()”lowerEntry(
key):MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1154
Returns the entry with the greatest key strictly less than key (an immutable snapshot), or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”MapEntry<K, V> | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”lowerKey()
Section titled “lowerKey()”lowerKey(
key):K|null
Defined in: src/map/TreeMap.ts:1162
Returns the greatest key strictly less than key, or null. O(log n).
Parameters
Section titled “Parameters”K
Returns
Section titled “Returns”K | null
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering and this map is not
empty
Implementation of
Section titled “Implementation of”merge()
Section titled “merge()”merge(
key,value,fn):V|null
Defined in: src/map/TreeMap.ts:896
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. O(log n) plus the cost of fn.
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, or key is null or undefined under natural
ordering
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”navigableKeySet()
Section titled “navigableKeySet()”navigableKeySet():
NavigableSet<K>
Defined in: src/map/TreeMap.ts:973
Returns a live, ascending view of the keys. Removing from it removes the mapping; add throws
UnsupportedOperationException.
Returns
Section titled “Returns”NavigableSet<K>
Implementation of
Section titled “Implementation of”pollFirstEntry()
Section titled “pollFirstEntry()”pollFirstEntry():
MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1113
Removes and returns the entry with the lowest key as an immutable snapshot, or null if this map is empty. O(log
n).
Returns
Section titled “Returns”MapEntry<K, V> | null
Implementation of
Section titled “Implementation of”pollLastEntry()
Section titled “pollLastEntry()”pollLastEntry():
MapEntry<K,V> |null
Defined in: src/map/TreeMap.ts:1125
Removes and returns the entry with the highest key as an immutable snapshot, or null if this map is empty. O(log
n).
Returns
Section titled “Returns”MapEntry<K, V> | null
Implementation of
Section titled “Implementation of”put(
key,value):V|null
Defined in: src/map/TreeMap.ts:759
Maps key to value, replacing any previous value. O(log n); O(1) to find the slot for a key above the current
maximum. Values may be null.
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”NullPointerException if key is null or undefined under natural ordering
Throws
Section titled “Throws”ClassCastException if key cannot be compared with the keys in this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”putAll()
Section titled “putAll()”putAll(
m):void
Defined in: src/abstract/AbstractMap.ts:119
Calls put for each mapping of a snapshot of m’s entries.
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 put is not supported and m is not empty
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”putFirst()
Section titled “putFirst()”putFirst(
_key,_value):V|null
Defined in: src/map/TreeMap.ts:1137
Not supported: the key order decides positions.
Parameters
Section titled “Parameters”K
_value
Section titled “_value”V
Returns
Section titled “Returns”V | null
Throws
Section titled “Throws”UnsupportedOperationException always
Implementation of
Section titled “Implementation of”putIfAbsent()
Section titled “putIfAbsent()”putIfAbsent(
key,value):V|null
Defined in: src/map/TreeMap.ts:768
Maps key to value if it is absent or mapped to null. O(log n).
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”NullPointerException if key is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”putLast()
Section titled “putLast()”putLast(
_key,_value):V|null
Defined in: src/map/TreeMap.ts:1145
Not supported: the key order decides positions.
Parameters
Section titled “Parameters”K
_value
Section titled “_value”V
Returns
Section titled “Returns”V | null
Throws
Section titled “Throws”UnsupportedOperationException always
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”Call Signature
Section titled “Call Signature”remove(
key):V|null
Defined in: src/map/TreeMap.ts:777
Removes the mapping for key, if present. O(log n).
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”NullPointerException if key is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”remove(
key,value):boolean
Defined in: src/map/TreeMap.ts:783
Removes the mapping for key only if it is currently mapped to a value equal to value. O(log n).
Parameters
Section titled “Parameters”unknown
unknown
Returns
Section titled “Returns”boolean
true if the mapping was removed
Throws
Section titled “Throws”NullPointerException if key is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”replace()
Section titled “replace()”Call Signature
Section titled “Call Signature”replace(
key,value):V|null
Defined in: src/abstract/AbstractMap.ts:250
Puts value only if key already has a mapping; returns the previous value, or null if there was no mapping.
Parameters
Section titled “Parameters”K
V
Returns
Section titled “Returns”V | null
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”replace(
key,oldValue,newValue):boolean
Defined in: src/abstract/AbstractMap.ts:252
Puts newValue only if key is mapped to a value equal to oldValue; returns true if replaced.
Parameters
Section titled “Parameters”K
oldValue
Section titled “oldValue”V
newValue
Section titled “newValue”V
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”replaceAll()
Section titled “replaceAll()”replaceAll(
fn):void
Defined in: src/map/TreeMap.ts:823
Replaces each value with fn(key, value), in ascending key order. This is not a structural change.
Parameters
Section titled “Parameters”(key, value) => V
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if fn is null
Throws
Section titled “Throws”ConcurrentModificationException if fn structurally modifies this map
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”reversed()
Section titled “reversed()”reversed():
NavigableMap<K,V>
Defined in: src/map/TreeMap.ts:994
Returns a live descending view; same as descendingMap().
Returns
Section titled “Returns”NavigableMap<K, V>
Implementation of
Section titled “Implementation of”sequencedEntrySet()
Section titled “sequencedEntrySet()”sequencedEntrySet():
SequencedSet<MapEntry<K,V>>
Defined in: src/map/TreeMap.ts:1018
Returns a live, sequenced view of the mappings in key order: the entrySet() view, except that add and addAll
throw UnsupportedOperationException.
Returns
Section titled “Returns”SequencedSet<MapEntry<K, V>>
Implementation of
Section titled “Implementation of”NavigableMap.sequencedEntrySet
sequencedKeySet()
Section titled “sequencedKeySet()”sequencedKeySet():
NavigableSet<K>
Defined in: src/map/TreeMap.ts:1002
Returns a live, sequenced view of the keys in ascending order: the navigableKeySet() view, except that add and
addAll throw UnsupportedOperationException.
Returns
Section titled “Returns”NavigableSet<K>
Implementation of
Section titled “Implementation of”sequencedValues()
Section titled “sequencedValues()”sequencedValues():
SequencedCollection<V>
Defined in: src/map/TreeMap.ts:1010
Returns a live, sequenced view of the values in key order: the values() view, except that add and addAll
throw UnsupportedOperationException.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”size()
Section titled “size()”size():
number
Defined in: src/map/TreeMap.ts:695
Returns the number of mappings. O(1).
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”Overrides
Section titled “Overrides”subMap()
Section titled “subMap()”Call Signature
Section titled “Call Signature”subMap(
fromKey,toKey):SortedMap<K,V>
Defined in: src/map/TreeMap.ts:1062
Returns a live view of the mappings with keys from fromKey (inclusive) to toKey (exclusive); same as
subMap(fromKey, true, toKey, false). O(1) to create.
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
Throws
Section titled “Throws”NullPointerException if either bound is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Call Signature
Section titled “Call Signature”subMap(
fromKey,fromInclusive,toKey,toInclusive):NavigableMap<K,V>
Defined in: src/map/TreeMap.ts:1069
Returns a live view of the mappings with keys between fromKey and toKey, each end included when its flag is
set. O(1) to create.
Parameters
Section titled “Parameters”fromKey
Section titled “fromKey”K
fromInclusive
Section titled “fromInclusive”boolean
K
toInclusive
Section titled “toInclusive”boolean
Returns
Section titled “Returns”NavigableMap<K, V>
Throws
Section titled “Throws”IllegalArgumentException if fromKey is greater than toKey
Throws
Section titled “Throws”NullPointerException if either bound is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”tailMap()
Section titled “tailMap()”Call Signature
Section titled “Call Signature”tailMap(
fromKey):SortedMap<K,V>
Defined in: src/map/TreeMap.ts:1045
Returns a live view of the mappings whose keys are greater than or equal to fromKey; same as tailMap(fromKey, true). O(1) to create, O(log n) per operation; putting a key outside the range through the view throws
IllegalArgumentException.
Parameters
Section titled “Parameters”fromKey
Section titled “fromKey”K
Returns
Section titled “Returns”SortedMap<K, V>
Throws
Section titled “Throws”NullPointerException if fromKey is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”Call Signature
Section titled “Call Signature”tailMap(
fromKey,inclusive):NavigableMap<K,V>
Defined in: src/map/TreeMap.ts:1051
Returns a live view of the mappings whose keys are greater than (or, if inclusive, equal to) fromKey. O(1) to
create.
Parameters
Section titled “Parameters”fromKey
Section titled “fromKey”K
inclusive
Section titled “inclusive”boolean
Returns
Section titled “Returns”NavigableMap<K, V>
Throws
Section titled “Throws”NullPointerException if fromKey is null or undefined under natural ordering
Implementation of
Section titled “Implementation of”toString()
Section titled “toString()”toString():
string
Defined in: src/abstract/AbstractMap.ts:191
Returns {k1=v1, k2=v2} in entry-set order; a key or value that is this map prints as (this Map).
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”Inherited from
Section titled “Inherited from”values()
Section titled “values()”values():
SequencedCollection<V>
Defined in: src/map/TreeMap.ts:965
Returns a live view of the values in ascending key order. Removing from it removes the mapping; it does not support
add (UnsupportedOperationException).