Create a new DefaultMap with a specified default value.
Time complexity: O(n)
Space complexity: O(n)
The default value to use for missing keys
Optionalentries: Iterable<readonly [unknown, unknown], any, any> | nullCreate a new DefaultMap with a specified function to generate default values.
Time complexity: O(n)
Space complexity: O(n)
Readonly[toReadonlysizeStatic Readonly[species]Removes all elements from the Map.
true if an element in the Map existed and has been removed, or false if the element does not exist.
Returns a specified element from the Map object.
If no element is associated with the specified key, a new element with the value defaultValue will be inserted into the Map and returned.
The element associated with the specified key, which will be defaultValue if no element previously existed.
Returns a specified element from the Map object.
If no element is associated with the specified key, the result of passing the specified key to the callback function will be inserted into the Map and returned.
The element associated with the specific key, which will be the newly computed value if no element previously existed.
boolean indicating whether an element with the specified key exists or not.
Returns an iterable of keys in the map
Returns an iterable of values in the map
Staticgroup
A
Mapthat has a default value for missing keys.Example
Example
Map