| Package | system.data.maps |
| Class | public dynamic class HashMap |
| Inheritance | HashMap Object |
| Implements | Map |
This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
Example :
import system.data.Map ;
import system.data.maps.HashMap;
import system.data.iterator.Iterator;
var map:Map = new HashMap() ;
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("--- dynamic insertion ") ;
map["key4"] = "value4" ; // dynamic insertion
trace("map : " + map) ;
trace("--- use delete") ;
delete map["key4"] ;
trace(" map : " + map) ;
trace("--- remove 'key1'") ;
trace("remove key1 : " + (delete map["key1"]) ) ; //.remove("key1")) ;
trace("size : " + map.size()) ;
trace("map : " + map) ;
trace("--- clear and isEmpty") ;
map.clear() ;
trace("isEmpty : " + map.isEmpty()) ;
| Method | Defined By | ||
|---|---|---|---|
HashMap(... arguments)
Creates a new HashMap instance. | HashMap | ||
clear():void
Removes all mappings from this map. | HashMap | ||
clone():*
Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned. | 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 | ||
get(key:*):*
Returns the value to which this map maps the specified key. | HashMap | ||
getKeys():Array
Returns an array representation of all keys in the map. | HashMap | ||
getValues():Array
Returns an array representation of all values in the map. | HashMap | ||
isEmpty():Boolean
Returns true if this map contains no key-value mappings. | HashMap | ||
Returns the values iterator of this map. | HashMap | ||
Returns the keys iterator of this map. | HashMap | ||
put(key:*, value:*):*
Associates the specified value with the specified key in this map. | HashMap | ||
Copies all of the mappings from the specified map to this one. | HashMap | ||
remove(o:*):*
Removes the mapping for this key from this map if present. | HashMap | ||
size():uint
Returns the number of key-value mappings in this map. | HashMap | ||
toSource(indent:int = 0):String
Returns the source representation of the object. | HashMap | ||
toString():String
Returns the String representation of this map. | HashMap | ||
| HashMap | () | Constructor |
public function HashMap(... arguments)Creates a new HashMap instance.
Parameters... arguments |
| 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.
|
| 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.
|
| 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.
|
| 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:* | |
value:* |
* |
| 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.
|
| 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 the object.
Parameters
indent:int (default = 0) |
String — the source representation of the object.
|
| toString | () | method |
public function toString():StringReturns the String representation of this map.
ReturnsString — the String representation of this map.
|