new MultiMap( [values])
Constructor.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
values |
* |
<optional> |
an object who's enumerable properties will be added to this map |
Methods
-
add(key, value)
-
Add a value.
This method will append values to existing keys.
Parameters:
Name Type Description key
string the key to use
value
* the value to add
Returns:
this object
- Type
- module:util~MutliMap
-
clear()
-
Remove all properties from this map.
Returns:
this object
- Type
- module:util~MutliMap
-
containsKey(key)
-
Test if there are any values associated with a key.
Parameters:
Name Type Description key
string the key to test
Returns:
true
if there is at least one value associated with the key- Type
- boolean
-
firstValue(key)
-
Get the first avaialble value assocaited with a key.
Parameters:
Name Type Description key
string the key of the value to get
Returns:
the first available value associated with the key, or
undefined
if not available- Type
- *
-
isEmpty()
-
Test if the map is empty.
Returns:
true
if there are no entries in this map- Type
- boolean
-
keySet()
-
Get an array of all keys in this map.
Returns:
array of keys in this map, or an empty array if the map is empty
- Type
- Array.<string>
-
put(key, value)
-
Set a value.
This method will replace any existing values with just
value
.Parameters:
Name Type Description key
string the key to use
value
* the value to set
Returns:
this object
- Type
- module:util~MutliMap
-
putAll(values)
-
Set multiple values.
This method will replace any existing values with those provided on
values
.Parameters:
Name Type Description values
* an object who's enumerable properties will be added to this map
Returns:
this object
- Type
- module:util~MutliMap
-
remove(key)
-
Remove all values associated with a key.
Parameters:
Name Type Description key
string the key of the values to remove
Returns:
the removed values, or
undefined
if no values were present for the given key- Type
- Array.<object>
-
size()
-
Get the number of entries in this map.
Returns:
the number of entries in the map
- Type
- number
-
value(key)
-
Get the values associated with a key.
Parameters:
Name Type Description key
string the key of the values to get
Returns:
the array of values associated with the key, or
undefined
if not available- Type
- Array.<object>