util~ MultiMap

A case-insensitive string key multi-value map object.

This map supports null values but ignores attempts to add keys with undefined values.

Constructor

new MultiMap(valuesopt)

Constructor.

Parameters:
NameTypeAttributesDescription
values*<optional>

an object who's enumerable properties will be added to this map

Methods

add(key, value) → {module:util~MutliMap}

Add a value.

This method will append values to existing keys.

Parameters:
NameTypeDescription
keystring

the key to use

value*

the value to add; if undefined nothing will be added

Returns:

this object

Type: 
module:util~MutliMap

clear() → {module:util~MutliMap}

Remove all properties from this map.

Returns:

this object

Type: 
module:util~MutliMap

containsKey(key) → {boolean}

Test if there are any values associated with a key.

Parameters:
NameTypeDescription
keystring

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:
NameTypeDescription
keystring

the key of the value to get

Returns:

the first available value associated with the key, or undefined if not available

Type: 
*

isEmpty() → {boolean}

Test if the map is empty.

Returns:

true if there are no entries in this map

Type: 
boolean

keySet() → {Array.<string>}

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) → {module:util~MutliMap}

Set a value.

This method will replace any existing values with just value.

Parameters:
NameTypeDescription
keystring

the key to use

value*

the value to set; if undefined nothing will be added

Returns:

this object

Type: 
module:util~MutliMap

putAll(values) → {module:util~MutliMap}

Set multiple values.

This method will replace any existing values with those provided on values.

Parameters:
NameTypeDescription
values*

an object who's enumerable properties will be added to this map

Returns:

this object

Type: 
module:util~MutliMap

remove(key) → {Array.<object>}

Remove all values associated with a key.

Parameters:
NameTypeDescription
keystring

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() → {number}

Get the number of entries in this map.

Returns:

the number of entries in the map

Type: 
number

value(key) → {Array.<object>}

Get the values associated with a key.

Parameters:
NameTypeDescription
keystring

the key of the values to get

Returns:

the array of values associated with the key, or undefined if not available

Type: 
Array.<object>