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.
Returns whether some value is SameValueZero-equal to value.
Time: O(n).
The value to look for.
true when a mapping has that value.
Returns a live view of the mappings as entries.
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, with this set to thisArg, as native
Map does.
Time: O(n) plus the calls.
Called with each value, its key and the map.
OptionalthisArg: unknown
The this value for action.
Returns whether a key equal to key is present.
Time: as get.
The key to look for.
true when the key is present.
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.
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 an iterator over the values.
Time: O(1) to create; O(1) per step.
A new iterator.
The read-only view of a map: every question a map answers, with the reading methods of native
Map(size,get,has,keys,values,entries,forEach, iteration over[key, value]pairs), sonew Map(map)copies it.Two maps are equal when they have the same size and each maps every key of the other to an equal value, whatever their insertion order. A map is not a
Collection; itskeySet(),entrySet()andvalueCollection()views are.Example