Map$Typings<K, V> extension
Properties
-
count
↔ num
-
This read-only property is the number of associations in the Map.
getter/setter pair
-
iterator
↔ IMapIterator<K, V>
-
Gets an object that you can use for iterating over the key-value pairs of a Map.
Typical usage:
getter/setter pair
-
iteratorKeys
↔ Iterator<K>
-
Gets an object that you can use for iterating over the keys of a Map.
Typical usage:
getter/setter pair
-
iteratorValues
↔ Iterator<V>
-
Gets an object that you can use for iterating over the values of a Map.
Typical usage:
getter/setter pair
-
size
↔ num
-
This read-only property is the number of associations in the Map.
getter/setter pair
Methods
-
add(K key, V val)
→ Map<K, V>
-
Adds a key-value association to the Map, or replaces the value associated with the key
if the key was already present in the map.
-
addAll(Object coll)
→ Map<K, V>
-
Adds all of the key-value pairs of another Map to this Map.
If a key is already present in this Map,
its value is replaced with the corresponding value from the given map.
-
all(bool pred(KeyValuePair<K, V>))
→ bool
-
This is true if all invocations of the given predicate on items in the collection are true.
-
any(bool pred(KeyValuePair<K, V>))
→ bool
-
This is true if any invocation of the given predicate on items in the collection is true.
-
clear()
→ void
-
Clears the Map, removing all key-value associations.
This sets the #count to zero.
-
contains(K key)
→ bool
-
Returns whether the given key is in this Map.
@param {K} key The key to look up in the Map.
@return {boolean} Whether or not the key is contained within the Map.
-
copy()
→ Map<K, V>
-
Makes a shallow copy of this Map.
The keys and their values are not copied,
so if they are objects they may continue to be shared with the original Map.
@expose
@return {Map.<K,V>} The new Map with copies of the same entries.
-
delete(K key)
→ bool
-
Removes a key (if found) from the Map.
-
each(void func(KeyValuePair<K, V>))
→ Map<K, V>
-
Call the given function on each key/value pair in the collection.
@expose
@param {function(KeyValuePair.<K,V>)} func The argument to the function will be an object with both "key" and "value" properties.
This function must not modify the collection.
@return {Map.<K,V>} This Map itself
@since 1.4
-
filter(bool pred(KeyValuePair<K, V>))
→ Map<K, V>
-
Call the given predicate on each key-value pair in the collection and for each pair that it returns true, add the key-value association in a new Map.
-
first()
→ KeyValuePair<K, V>
-
Returns the first key/value pair in the collection, or null if there is none.
@return {KeyValuePair.<K,V>} This returns null if there are no items in the collection.
@since 1.4
-
get(K key)
→ V?
-
Returns the value associated with a key.
@param {K} key The key to look up in the Map.
@return {V|null} The value associated with the given key, or null if not present in the Map.
-
getValue(K key)
→ V?
-
Returns the value associated with a key.
@param {K} key The key to look up in the Map.
@return {V|null} The value associated with the given key, or null if not present in the Map.
-
has(K key)
→ bool
-
Returns whether the given key is in this Map.
@param {K} key The key to look up in the Map.
@return {boolean} Whether or not the key is contained within the Map.
-
map<S>(S func(KeyValuePair<K, V>))
→ Map<K, S>
-
Call the given function on each key-value pair in the collection and associate the key with the result of the function in a new Map.
-
remove(K key)
→ bool
-
Removes a key (if found) from the Map.
-
set(K key, V val)
→ Map<K, V>
-
Adds a key-value association to the Map, or replaces the value associated with the key
if the key was already present in the map.
-
toArray()
→ Array<KeyValuePair<K, V>>
-
Produces a JavaScript Array of key/value pair objects from the contents of this Map.
@return {Array.<KeyValuePair.<K,V>>} A copy of the Map in Array form,
each element being an Object with 'key' and 'value' properties.
-
toKeySet()
→ Set<K>
-
Produces a Set that provides a read-only view onto the keys of this Map.
The collection of keys is not copied.
@return {Set.
-
toString$()
→ String
-
@return {string}