Packagecom.addicted2flash.util
Classpublic class HashMap
ImplementsIMap

Hashtable (Dictionary) based implementation of the IMap interface. This implementation provides all of the optional IMap operations, and permits null values and the null key.



Public Properties
 PropertyDefined by
  firstEntry : Entry
[read-only] return first Entry.
HashMap
Protected Properties
 PropertyDefined by
  _count : int
HashMap
  _first : Entry
HashMap
  _keyMap : Dictionary
HashMap
Public Methods
 MethodDefined by
  
Create a new HashMap
HashMap
  
clear():void
Removes all of the mappings from this map (optional operation).
HashMap
  
Returns a copy of the IMap.
HashMap
  
containsKey(key:*):Boolean
Returns true if this map contains a mapping for the specified key.
HashMap
  
containsValue(value:*):Boolean
Returns true if this map maps one or more keys to the specified value.
HashMap
  
dispose():void
free memory for garbage collection.
HashMap
  
Returns a Set view of the mappings contained in this map.
HashMap
  
getValue(key:*):*
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
HashMap
  
isEmpty():Boolean
Returns true if this map contains no key-value mappings.
HashMap
  
Returns a Set view of the keys contained in this map.
HashMap
  
put(key:*, value:*):*
Associates the specified value with the specified key in this map (optional operation).
HashMap
  
remove(key:*):*
Removes the mapping for a key from this map if it is present (optional operation).
HashMap
  
size():int
Returns the number of key-value mappings in this map.
HashMap
  
toString():String
String representation of the HashMap.
HashMap
  
Returns a Collection view of the values contained in this map.
HashMap
Property detail
_countproperty
protected var _count:int
_firstproperty 
protected var _first:Entry
firstEntryproperty 
firstEntry:Entry  [read-only]

return first Entry.

Implementation
    public function get firstEntry():Entry
_keyMapproperty 
protected var _keyMap:Dictionary
Constructor detail
HashMap()constructor
public function HashMap()

Create a new HashMap

Method detail
clear()method
public function clear():void

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

clone()method 
public function clone():IMap

Returns a copy of the IMap.

Returns
IMap — a copy of the IMap
containsKey()method 
public function containsKey(key:*):Boolean

Returns true if this map contains a mapping for the specified key.

Parameters
key:* — key whose presence in this map is to be tested

Returns
Boolean — true if this map contains a mapping for the specified key
containsValue()method 
public function containsValue(value:*):Boolean

Returns true if this map maps one or more keys to the specified value.

Parameters
value:* — value whose presence in this map is to be tested

Returns
Boolean — true if this map maps one or more keys to the specified value
dispose()method 
public function dispose():void

free memory for garbage collection.

entrySet()method 
public function entrySet():ISet

Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.

NOTE: Entry objects removed with an IIterator are not removed from the IMap.

Returns
ISet — a set view of the Entry objects contained in this map
getValue()method 
public function getValue(key:*):*

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Parameters
key:* — the key whose associated value is to be returned

Returns
* — the value to which the specified key is mapped, or null if this map contains no mapping for the key
isEmpty()method 
public function isEmpty():Boolean

Returns true if this map contains no key-value mappings.

Returns
Boolean — true if this map contains no key-value mappings
keySet()method 
public function keySet():ISet

Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.

NOTE: keys removed with an IIterator are not removed from the IMap.

Returns
ISet — a set view of the keys contained in this map
put()method 
public function put(key:*, value:*):*

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value

Parameters
key:* — key with which the specified value is to be associated
 
value:* — value to be associated with the specified key

Returns
* — the previous value associated with key, or null if there was no mapping for key
remove()method 
public function remove(key:*):*

Removes the mapping for a key from this map if it is present (optional operation). Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.

Parameters
key:* — key whose mapping is to be removed from the map

Returns
* — the previous value associated with key, or null if there was no mapping for key
size()method 
public function size():int

Returns the number of key-value mappings in this map.

Returns
int — the number of key-value mappings in this map
toString()method 
public function toString():String

String representation of the HashMap.

Returns
String — String representation of the HashMap
values()method 
public function values():ICollection

Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa.

NOTE: values removed with an IIterator are not removed from the IMap.

Returns
ICollection — a collection view of the values contained in this map