ReadonlyrevisionA number that changes on every change to the mappings — adding or removing one, or writing a value — and never on a read, except that a read moving a mapping of an access-ordered map changes it too. Its exact values are unspecified. Time: O(1).
ReadonlysizeThe number of mappings. Time: O(1).
The value-equality protocol; delegates to equals. Time: as equals.
The value-equality protocol: an order-independent combination of the mappings' hashes. Time: O(n) plus the calls.
Removes every mapping. Time: as the implementation documents.
Returns the comparator that orders the keys, or undefined for natural order; a reversed view
returns a function that orders in reverse.
Time: O(1).
The comparator, or undefined.
Maps key to fn(currentValueOrUndefined, key, map), or removes the mapping when the result
is undefined, and returns the result.
Time: as set, plus the call.
The result of fn.
When key is present, maps it to fn(value, key, map), or removes the mapping when the
result is undefined, and returns the result; otherwise returns undefined without calling
fn.
Time: as set, plus the call.
The result of fn, or undefined.
Returns whether some value is SameValueZero-equal to value.
Time: O(n).
The value to look for.
true when a mapping has that value.
Removes the mapping of key and returns whether there was one.
Time: as set.
The key.
true when a mapping was removed.
Returns a live view of the mappings as entries, in key order, with the ends of this map;
removing an entry removes its mapping, and adding throws UnsupportedOperationError.
Time: O(1).
A new view.
Returns whether other is a map with the same size that maps every key of this map to an equal
value, and whose keys this map all maps to equal values.
Time: as the map documents — O(n) average for a HashMap, O(n log n) for a TreeMap — plus
the protocol methods.
Any value.
true when other is an equal map.
Calls action(value, key, map) for each mapping in key order, with this set to thisArg.
Time: O(n) plus the calls.
Called with each value, its key and the map.
OptionalthisArg: unknown
The this value for action.
Returns the value of key when present; otherwise calls fn(key), maps key to its result
and returns it, as native Map.prototype.getOrInsertComputed does.
Time: as set, plus the call.
The mapped value.
Returns whether a key equal to key is present.
Time: as get.
The key to look for.
true when the key is present.
Returns a live view of the mappings whose keys are before to (exclusive by default); changes
through the view reach this map.
Time: O(log n).
The high end, in this map's order.
Optionaloptions: BoundOptions | null
The inclusive flag.
The view.
Returns whether the map has no mappings.
Time: O(1).
size === 0.
Returns an iterator over the keys.
Time: O(1) to create; O(1) per step.
A new iterator.
Maps key to value when it is absent; otherwise to fn(old, value, key, map), removing
the mapping when that result is undefined. Returns the stored value, or undefined.
Time: as set, plus the call.
The stored value, or undefined when the mapping was removed.
Sets every mapping of entries in order, after reading and checking them all.
Time: as the map documents — O(m) average for a HashMap, O(m log(n + m)) for a TreeMap —
for m mappings.
Replaces each value with fn(value, key, map), in iteration order.
Time: O(n) plus the calls.
Returns a live view of the mappings whose keys run from from (inclusive by default) to to
(exclusive by default); changes through the view reach this map.
Time: O(log n).
The low end, in this map's order.
The high end, in this map's order.
Optionaloptions: SubSetOptions | null
The inclusive flags.
The view.
Returns a live view of the mappings whose keys are from (inclusive by default) or after it;
changes through the view reach this map.
Time: O(log n).
The low end, in this map's order.
Optionaloptions: BoundOptions | null
The inclusive flag.
The view.
Returns the class name, size and mappings, e.g. HashMap(1) {'a' => 1}.
Time: O(length of the output) for flat contents.
The text.
Returns a live view of the values, in key order, with the ends of this map; removing a value
removes a mapping with that value, and adding throws UnsupportedOperationError.
Time: O(1).
A new view.
Returns an iterator over the values.
Time: O(1) to create; O(1) per step.
A new iterator.
A map kept in the order of its keys under a comparator, with the ends, nearest-entry queries, removal of the first and last mappings, and live range views. Two keys are the same key when the comparator returns
0for them. Setting a key outside a range view's range through the view throwsIllegalArgumentError. As a sequenced map it has ends and a reversed view, butputFirstandputLastthrowUnsupportedOperationError: each mapping's place is decided by its key.Example