new Map()
Methods
-
clear()
-
Removes all of the mappings from this map. The map will be empty after this call returns..
-
containsKey(key)
-
Returns true if this map contains a mapping for the specified key.
Parameters:
Name Type Description key
String the key whose presence in this map is to be tested
-
containsValue(value)
-
Returns true if this Map maps one or more keys to the specified value.
Parameters:
Name Type Description value
String the value whose presence in this Map is to be tested
-
get(key) → {Object}
-
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
Parameters:
Name Type Description key
String the key whose associated value is to be returned
Returns:
the value to which the specified key is mapped, or null if this map contains no mapping for the key
- Type
- Object
-
keys() → {Array}
-
Returns a {Array} of the keys contained in this Map.
Returns:
an array of the keys contained in this Map.
- Type
- Array
-
mapSize() → {Number}
-
Returns the number of key-value mappings in this Map.
Returns:
the number of key-value mappings in this Map.
- Type
- Number
-
put(key, value)
-
Associates the specified value with the specified key in this map.
Parameters:
Name Type Description key
String key with which the specified value is to be associated
value
Object value to be associated with the specified key
-
remove(key)
-
Removes the mapping for a key from this map if it is present.
Parameters:
Name Type Description key
String key whose mapping is to be removed from the map
-
values() → {Array}
-
Returns a {Array} of the values contained in this Map.
Returns:
an array view of the values contained in this map
- Type
- Array