An collection object that maps keys to values. Each key can map to at most one value and cannot be undefined. Also note that a HashMap makes no guarantees with regard to order of its elements.
asdk.HashMap
class
Method | Description |
getSize() |
Returns the total number of key/value pairs stored within the HashMap |
isEmpty() |
A Boolean value indicating whether the HashMap is empty (true) or not (false). |
setComparator( condition ) |
Sets the comparator for the HashMap; this allows for customizing how objects are compared by using various
implementations of the asdk.condition.BinaryCondition interface. The default comparator is asdk.condition.ObjectsEqual . |
containsKey( key ) |
A Boolean value indicating whether the specified key is stored in the HashMap. |
containsValue( value ) |
A Boolean value indicating whether the specified value is stored in the HashMap. |
get( key ) |
Returns the value that corresponds to the specified key or null if a value does not exist. |
put( key, value ) |
Stores the value within the HashMap and associates it with the corresponding key. If a value was previously associated with the key, the old value is returned; if a value was not previously associated with the key, null is returned. |
remove( key ) |
Removes the value that is associated with the corresponding key and returns the value. |
putAll( t: Map ) |
Copies all the key/value pairs into the HashMap. |
clear() |
Removes all of the key/value pairs from the HashMap. |
getKeys() |
Returns all the keys in the HashMap as an asdk.Set |
getValues() |
Returns all the value in the HashMap as an asdk.Collection |
getKeysIterator() |
Returns an iterator that can traverse all the keys within the HashMap. |
getValuesIterator() |
Returns an iterator that can traverse all the values within the HashMap. |
iterator( type : Number ) |
Returns an iterator that can traverse all the keys or values within the HashMap depending on the type that is passed into the method. The default behavior returns an iterator for the values within the HashMap; in order to retreive an iterator for the keys, pass asdk.ASDKConstants.KEYS into the method as the type parameter. |