Packagesystem.data.maps
Classpublic dynamic class ArrayMap
InheritanceArrayMap Inheritance Object
Implements Map
Subclasses SortedArrayMap

Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key.

This class makes guarantees to the order of the map.

Example :

     import system.data.Map ;
     import system.data.map.ArrayMap;
     import system.data.iterator.Iterator;
     
     var map:Map = new ArrayMap() ;
     
     trace("put key1 -> value0 : " + map.put("key1", "value0") ) ;
     trace("put key1 -> value1 : " + map.put("key1", "value1") ) ;
     trace("put key2 -> value2 : " + map.put("key2", "value2") ) ;
     trace("put key3 -> value3 : " + map.put("key3", "value3") ) ;
     
     trace("map : " + map) ;
     
     trace("--- clone") ;
     
     var clone:Map = map.clone() ;
     trace("clone : " + clone) ;
     
     trace("--- map toSource") ;
     
     trace("map toSource : " + map.toSource()) ;
     
     trace("--- iterator") ;
     
     var it:Iterator = map.iterator() ;
     while( it.hasNext() )
     {
         var v:= it.next() ;
         var k:= it.key() ;
         trace( "   -> " + k + " : " + v ) ;
     }
     trace("map : " + map) ;
     
     trace("remove key1 : " + map.remove("key1")) ;
     
     trace("size : " + map.size()) ;
     
     trace("map : " + map) ;
     
     trace("--- clear and isEmpty") ;
     
     map.clear() ;
     
     trace("isEmpty : " + map.isEmpty()) ;  
     



Public Methods
 MethodDefined By
  
ArrayMap(... arguments)
Creates a new ArrayMap instance.
ArrayMap
  
clear():void
Removes all mappings from this map.
ArrayMap
  
clone():*
Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned.
ArrayMap
  
containsKey(key:*):Boolean
Returns true if this map contains a mapping for the specified key.
ArrayMap
  
containsValue(value:*):Boolean
Returns true if this map maps one or more keys to the specified value.
ArrayMap
  
get(key:*):*
Returns the value to which this map maps the specified key.
ArrayMap
  
getKeyAt(index:uint):*
Returns the key registered at the specified index in the array map.
ArrayMap
  
getKeys():Array
Returns an array representation of all keys in the map.
ArrayMap
  
getValueAt(index:uint):*
Returns the value registered at the specified index in the array map.
ArrayMap
  
getValues():Array
Returns an array representation of all values in the map.
ArrayMap
  
indexOfKey(key:*):int
Returns the index position in the ArrayMap of the specified key.
ArrayMap
  
indexOfValue(value:*):int
Returns the index position in the ArrayMap of the specified value.
ArrayMap
  
isEmpty():Boolean
Returns true if this map contains no key-value mappings.
ArrayMap
  
Returns the values iterator of this map.
ArrayMap
  
Returns the keys iterator of this map.
ArrayMap
  
put(key:*, value:*):*
Associates the specified value with the specified key in this map.
ArrayMap
  
putAll(m:Map):void
Copies all of the mappings from the specified map to this one.
ArrayMap
  
remove(o:*):*
Removes the mapping for this key from this map if present.
ArrayMap
  
setKeyAt(index:uint, key:*):*
Sets the value of the "key" in the ArrayMap with the specified index.
ArrayMap
  
setValueAt(index:uint, value:*):*
Sets the value of the "value" in the ArrayMap with the specified index.
ArrayMap
  
size():uint
Returns the number of key-value mappings in this map.
ArrayMap
  
toSource(indent:int = 0):String
Returns the source representation of this map.
ArrayMap
  
toString():String
Returns the String representation of this map.
ArrayMap
Constructor Detail
ArrayMap()Constructor
public function ArrayMap(... arguments)

Creates a new ArrayMap instance.

Parameters
... arguments — An optional Array of all keys to fill in this Map.
Method Detail
clear()method
public function clear():void

Removes all mappings from this map.

clone()method 
public function clone():*

Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned.

Returns
* — a shallow copy of this HashMap instance: the keys and values themselves are not cloned.
containsKey()method 
public function containsKey(key:*):Boolean

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

Parameters

key:*

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:*

Returns
Boolean — true if this map maps one or more keys to the specified value.
get()method 
public function get(key:*):*

Returns the value to which this map maps the specified key.

Parameters

key:*

Returns
* — the value to which this map maps the specified key.
getKeyAt()method 
public function getKeyAt(index:uint):*

Returns the key registered at the specified index in the array map.

Parameters

index:uint

Returns
* — the key registered at the specified index in the array map.
getKeys()method 
public function getKeys():Array

Returns an array representation of all keys in the map.

Returns
Array — an array representation of all keys in the map.
getValueAt()method 
public function getValueAt(index:uint):*

Returns the value registered at the specified index in the array map.

Parameters

index:uint

Returns
* — the value registered at the specified index in the array map.
getValues()method 
public function getValues():Array

Returns an array representation of all values in the map.

Returns
Array — an array representation of all values in the map.
indexOfKey()method 
public function indexOfKey(key:*):int

Returns the index position in the ArrayMap of the specified key.

Parameters

key:*

Returns
int — the index position in the ArrayMap of the specified key.
indexOfValue()method 
public function indexOfValue(value:*):int

Returns the index position in the ArrayMap of the specified value.

Parameters

value:*

Returns
int — the index position in the ArrayMap of the specified value.
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.
iterator()method 
public function iterator():Iterator

Returns the values iterator of this map.

Returns
Iterator — the values iterator of this map.
keyIterator()method 
public function keyIterator():Iterator

Returns the keys iterator of this map.

Returns
Iterator — the keys iterator of this map.
put()method 
public function put(key:*, value:*):*

Associates the specified value with the specified key in this map.

Parameters

key:* — the key to register the value.
 
value:* — the value to be mapped in the map.

Returns
*
putAll()method 
public function putAll(m:Map):void

Copies all of the mappings from the specified map to this one.

Parameters

m:Map

remove()method 
public function remove(o:*):*

Removes the mapping for this key from this map if present.

Parameters

o:* — The key whose mapping is to be removed from the map.

Returns
* — previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.
setKeyAt()method 
public function setKeyAt(index:uint, key:*):*

Sets the value of the "key" in the ArrayMap with the specified index.

Parameters

index:uint — The position of the entry in the ArrayMap.
 
key:* — The value of the entry to change.

Returns
* — A MapEntry who corresponding the old key/value entry or null if the key already exist or the specified index don't exist.

Throws
RangeError — If the index is out of the range of the Map size.
setValueAt()method 
public function setValueAt(index:uint, value:*):*

Sets the value of the "value" in the ArrayMap with the specified index.

Parameters

index:uint — The position of the entry in the ArrayMap.
 
value:* — The value of the entry to change.

Returns
* — A MapEntry who corresponding the old key/value entry or null if no value exist with the specified index.

Throws
RangeError — If the index is out of the range of the Map size.
size()method 
public function size():uint

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

Returns
uint — the number of key-value mappings in this map.
toSource()method 
public function toSource(indent:int = 0):String

Returns the source representation of this map.

Parameters

indent:int (default = 0)

Returns
String — the source representation of this map.
toString()method 
public function toString():String

Returns the String representation of this map.

Returns
String — the String representation of this map.