goog.structs.Map
Classgoog.structs.Map(opt_map, var_args)
Class for Hash Map datastructure.
opt_map
{*=}
var_args
{...*}
.__iterator__(opt_keys)
Returns an iterator that iterates over the values or the keys in the map. This throws an exception if the map was mutated since the iterator was created.
opt_keys
{boolean
=}
goog.iter.Iterator
}
.addAll(map)
Adds multiple key-value pairs from another goog.structs.Map or Object.
map
{Object
}
.clear()
Removes all key-value pairs from the map.
.clone()
Clones a map and returns a new map.
goog.structs.Map
}
.containsKey(key)
Whether the map contains the given key.
key
{*}
boolean
}
.containsValue(val)
Whether the map contains the given value. This is O(n).
val
{*}
boolean
}
.defaultEquals(a, b)
Default equality test for values.
a
{*}
b
{*}
boolean
}
.equals(otherMap, opt_equalityFn)
Whether this map is equal to the argument map.
otherMap
{goog.structs.Map
}
opt_equalityFn
{function
(?, ?) : boolean
=}
boolean
}
.get(key, opt_val)
Returns the value for the given key. If the key is not found and the default value is not given this will return {@code undefined}.
key
{*}
opt_val
{*=}
.getCount()
number
}
.getKeyIterator()
Returns an iterator that iterates over the keys in the map. Removal of keys while iterating might have undesired side effects.
goog.iter.Iterator
}
.getKeys()
Returns the keys of the map.
Array
.<string
>}
.getValueIterator()
Returns an iterator that iterates over the values in the map. Removal of keys while iterating might have undesired side effects.
goog.iter.Iterator
}
.getValues()
Returns the values of the map.
Array
}
.isEmpty()
boolean
}
.remove(key)
Removes a key-value pair based on the key. This is O(logN) amortized due to updating the keys array whenever the count becomes half the size of the keys in the keys array.
key
{*}
boolean
}
.set(key, value)
Adds a key-value pair to the map.
key
{*}
value
{*}
.toObject()
Object
}
.transpose()
Returns a new map in which all the keys and values are interchanged (keys become values and values become keys). If multiple keys map to the same value, the chosen transposed value is implementation-dependent. It acts very similarly to {goog.object.transpose(Object)}.
goog.structs.Map
}