Class goog.structs.Map.<K, V>
code »Class for Hash Map datastructure.
Constructor
Parameters |
---|
|
Instance Methods
code »__iterator__ ( opt_keys ) ⇒ !goog.iter.Iterator
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.
!goog.iter.Iterator
Parameters |
---|
|
Returns |
|
Cleans up the temp keys array by removing entries that are no longer in the
map.
code »clone ( ) ⇒ !goog.structs.Map
Clones a map and returns a new map.
!goog.structs.Map
Returns |
---|
|
code »containsKey ( key ) ⇒ boolean
Whether the map contains the given key.
boolean
Parameters |
---|
|
Returns |
|
code »containsValue ( val ) ⇒ boolean
Whether the map contains the given value. This is O(n).
boolean
Parameters |
---|
|
Returns |
|
Whether this map is equal to the argument map.
Parameters |
---|
|
Returns |
|
Returns the value for the given key. If the key is not found and the default
value is not given this will return undefined
.
undefined
.Parameters |
---|
|
Returns |
|
Returns an iterator that iterates over the keys in the map. Removal of keys
while iterating might have undesired side effects.
Returns |
---|
|
Returns an iterator that iterates over the values in the map. Removal of
keys while iterating might have undesired side effects.
Returns |
---|
|
code »transpose ( ) ⇒ !goog.structs.Map
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
Returns |
---|
|
Instance Properties
An array of keys. This is necessary for two reasons:
1. Iterating the keys using for (var key in this.map_) allocates an
object for every key in IE which is really bad for IE6 GC perf.
2. Without a side data structure, we would need to escape all the keys
as that would be the only way we could tell during iteration if the
key was an internal key or a property of the object.
This array can contain deleted keys so it's necessary to check the map
as well to see if the key is still in the map (this doesn't require a
memory allocation in IE).
Static Functions
code »goog.structs.Map.defaultEquals ( a, b ) ⇒ boolean
Default equality test for values.
boolean
Parameters |
---|
|
Returns |
|
code »goog.structs.Map.hasKey_ ( obj, key ) ⇒ boolean
Safe way to test for hasOwnProperty. It even allows testing for
'hasOwnProperty'.
boolean
Parameters |
---|
|
Returns |
|