| Package | vegas.data.map |
| Class | public dynamic class HashMap |
| Inheritance | HashMap flash.utils.Proxy |
| Implements | Map |
Example :
package
{
import flash.display.Sprite;
import flash.utils.
import vegas.data.Map ;
import vegas.data.map.HashMap;
import vegas.data.iterator.Iterator;
public class TestHashMap extends Sprite
{
public function TestHashMap()
{
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("> map : " + map) ;
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("> remove key1 : " + map.remove("key1")) ;
trace("> size : " + map.size()) ;
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 | ||
|
copy():*
Returns a deep copy ot this HashMap instance.
| 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 | ||
|
hashCode():uint
Returns a hashcode value for the object.
| 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 eden String representation of this map.
| HashMap | ||
|
toString():String
Returns the String representation of this map.
| HashMap | ||
| Method | Defined by | ||
|---|---|---|---|
|
callProperty(methodName:*, ... rest):*
Overrides the behavior of an object property that can be called as a function.
| HashMap | ||
|
deleteProperty(name:*):Boolean
Invoked when a property is deleted in the hashmap.
| HashMap | ||
|
getProperty(name:*):*
If the property can't be found, the method returns undefined.
| HashMap | ||
|
setProperty(name:*, value:*):void
If the property can't be found, this method creates a property with the specified name and value.
| HashMap | ||
| HashMap | () | constructor |
public function HashMap(... arguments)Creates a new HashMap instance.
Parameters... arguments |
| callProperty | () | method |
flash_proxy override function callProperty(methodName:*, ... rest):*Overrides the behavior of an object property that can be called as a function. When a method of the object is invoked, this method is called. While some objects can be called as functions, some object properties can also be called as functions.
ParametersmethodName:* |
|
... rest |
* |
| 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.
Parameterskey:* |
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.
Parametersvalue:* |
Boolean — true if this map maps one or more keys to the specified value.
|
| copy | () | method |
public function copy():*Returns a deep copy ot this HashMap instance.
Returns* — a deep copy ot this HashMap instance.
|
| deleteProperty | () | method |
flash_proxy override function deleteProperty(name:*):BooleanInvoked when a property is deleted in the hashmap.
import vegas.data.map.HashMap;
var map:HashMap = new HashMap() ;
trace("> put key1 -> value1 : " + map.put("key1", "value1") ) ;
trace("> put key2 -> value2 : " + map.put("key2", "value2") ) ;
trace("> map : " + map) ;
var isDeleted:Boolean = delete map["key1"] ;
trace("> remove key1 : " + isDeleted ) ;
trace("> map : " + map) ;
Parameters
name:* |
Boolean — true if the key is removed.
|
| get | () | method |
public function get(key:*):*Returns the value to which this map maps the specified key.
Parameterskey:* |
* — 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.
|
| getProperty | () | method |
flash_proxy override function getProperty(name:*):*If the property can't be found, the method returns undefined. For more information on this behavior, see the ECMA-262 Language Specification, 3rd Edition.
Parametersname:* |
* |
| 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.
|
| hashCode | () | method |
public function hashCode():uintReturns a hashcode value for the object.
Returnsuint — a hashcode value for the object.
|
| 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.
Parameterskey:* |
|
value:* |
* |
| putAll | () | method |
public function putAll(m:Map):voidCopies all of the mappings from the specified map to this one.
Parametersm:Map |
| remove | () | method |
public function remove(o:*):*Removes the mapping for this key from this map if present.
Parameterso:* |
* |
| setProperty | () | method |
flash_proxy override function setProperty(name:*, value:*):voidIf the property can't be found, this method creates a property with the specified name and value.
Parametersname:* — The name of the property to modify.
|
|
value:* — The value to set the property to.
|
| 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 eden String representation of this map.
Parametersindent:int (default = 0) |
String — the eden String representation of this map.
|
| toString | () | method |
public function toString():StringReturns the String representation of this map.
ReturnsString — the String representation of this map.
|