labs.structs.Multimap Extends
Creates a new multimap.

Inheritance

Constructor

goog.labs.structs.Multimap()

Instance Methods

Public Protected Private
add(keyvalue)
Adds the given (key, value) pair to the map. The (key, value) pair is guaranteed to be added.
Arguments:
key : string
The key to add.
value : *
The value to add.
code »
addAllFromMultimap(map)
Adds the contents of the given map/multimap to this multimap.
Arguments:
map : !(goog.labs.structs.Map | goog.labs.structs.Multimap)
The map to add.
code »
addAllValues(keyvalues)
Stores a collection of values to the given key. Does not replace existing (key, value) pairs.
Arguments:
key : string
The key to add.
values : !Array.<*>
The values to add.
code »
clear()
Clears the multimap.
code »
Clones this multimap.
Returns: !goog.labs.structs.Multimap  A multimap that contains all the mapping this multimap has.
code »
containsEntry(keyvalue) boolean
No description.
Arguments:
key : string
The key to check.
value : *
The value to check.
Returns: boolean  Whether the (key, value) pair exists in the multimap.
code »
containsKey(key) boolean
No description.
Arguments:
key : string
The key to check.
Returns: boolean  Whether the multimap contains at least one (key, value) pair with the given key.
code »
containsValue(value) boolean
No description.
Arguments:
value : *
The value to check.
Returns: boolean  Whether the multimap contains at least one (key, value) pair with the given value.
code »
get(key) !Array.<*>
Gets the values correspond to the given key.
Arguments:
key : string
The key to retrieve.
Returns: !Array.<*>  An array of values corresponding to the given key. May be empty. Note that the ordering of values are not guaranteed to be consistent.
code »
getCount() number
No description.
Returns: number  The count of (key, value) pairs in the map.
code »
getEntries() !Array.<!Array>
No description.
Returns: !Array.<!Array>  An array of entries. Each entry is of the form [key, value].
code »
getKeys() !Array.<string>
No description.
Returns: !Array.<string>  An array of unique keys.
code »
getValues() !Array.<*>
No description.
Returns: !Array.<*>  An array of values. There may be duplicates.
code »
isEmpty() boolean
No description.
Returns: boolean  Whether the multimap is empty.
code »
remove(keyvalue) boolean
Removes a single occurrence of (key, value) pair.
Arguments:
key : string
The key to remove.
value : *
The value to remove.
Returns: boolean  Whether any matching (key, value) pair is removed.
code »
removeAll(key) boolean
Removes all values corresponding to the given key.
Arguments:
key : string
The key whose values are to be removed.
Returns: boolean  Whether any value is removed.
code »
replaceValues(keyvalues)
Replaces all the values for the given key with the given values.
Arguments:
key : string
The key whose values are to be replaced.
values : !Array.<*>
The new values. If empty, this is equivalent to removaAll(key).
code »

Instance Properties

count_ :
No description.
Code »
The backing map.
Code »

Package labs.structs

Package Reference