| Package | system.data.maps |
| Class | public dynamic class ArrayMap |
| Inheritance | ArrayMap Object |
| Implements | Map |
| Subclasses | SortedArrayMap |
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()) ;
| Method | Defined 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 | ||
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 | ||
| ArrayMap | () | Constructor |
public function ArrayMap(... arguments)Creates a new ArrayMap instance.
Parameters... arguments — An optional Array of all keys to fill in this Map.
|
| clear | () | method |
public function clear():voidRemoves 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:*):BooleanReturns true if this map contains a mapping for the specified key.
Parameters
key:* |
Boolean — true if this map contains a mapping for the specified key.
|
| containsValue | () | method |
public function containsValue(value:*):BooleanReturns true if this map maps one or more keys to the specified value.
Parameters
value:* |
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:* |
* — 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 |
* — the key registered at the specified index in the array map.
|
| getKeys | () | method |
public function getKeys():ArrayReturns an array representation of all keys in the map.
ReturnsArray — 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 |
* — the value registered at the specified index in the array map.
|
| getValues | () | method |
public function getValues():ArrayReturns an array representation of all values in the map.
ReturnsArray — an array representation of all values in the map.
|
| indexOfKey | () | method |
public function indexOfKey(key:*):intReturns the index position in the ArrayMap of the specified key.
Parameters
key:* |
int — the index position in the ArrayMap of the specified key.
|
| indexOfValue | () | method |
public function indexOfValue(value:*):intReturns the index position in the ArrayMap of the specified value.
Parameters
value:* |
int — the index position in the ArrayMap of the specified value.
|
| isEmpty | () | method |
public function isEmpty():BooleanReturns true if this map contains no key-value mappings.
ReturnsBoolean — true if this map contains no key-value mappings.
|
| iterator | () | method |
public function iterator():IteratorReturns the values iterator of this map.
ReturnsIterator — the values iterator of this map.
|
| keyIterator | () | method |
public function keyIterator():IteratorReturns the keys iterator of this map.
ReturnsIterator — 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.
|
* |
| putAll | () | method |
public function putAll(m:Map):voidCopies 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.
|
* — 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.
|
* — A MapEntry who corresponding the old key/value entry or null if the key already exist or the specified index don't exist.
|
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.
|
* — A MapEntry who corresponding the old key/value entry or null if no value exist with the specified index.
|
RangeError — If the index is out of the range of the Map size.
|
| size | () | method |
public function size():uintReturns the number of key-value mappings in this map.
Returnsuint — the number of key-value mappings in this map.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source representation of this map.
Parameters
indent:int (default = 0) |
String — the source representation of this map.
|
| toString | () | method |
public function toString():StringReturns the String representation of this map.
ReturnsString — the String representation of this map.
|