Package | org.spicefactory.lib.collection |
Class | public class Map |
Inheritance | Map Object |
Due to limitations in the Flash Proxy class which only accepts String-based keys,
the Map
class does not support for
and for each
loops
or bracket access for reading and writing values. For loops you can loop over Map.keys
or Map.values
instead.
Property | Defined By | ||
---|---|---|---|
keys : List [read-only]
All keys of this map in no particular oder. | Map | ||
values : List [read-only]
All values of this map in no particular order. | Map |
Method | Defined By | ||
---|---|---|---|
Map(dictionary:Dictionary = null)
Creates a new instance. | Map | ||
Clones this map. | Map | ||
containsKey(key:Object):Boolean
Indicates whether this map contains a value mapped to the specified key. | Map | ||
containsValue(value:*):Boolean
Indicates whether this map contains the specified value at least once. | Map | ||
get(key:Object):*
Returns the value mapped to the specified key or undefined. | Map | ||
isEmpty():Boolean
Indicates whether this map is empty. | Map | ||
put(key:Object, value:*):*
Adds a value for the specified key. | Map | ||
remove(key:Object):*
Removes and returns the value mapped to the specified key. | Map | ||
removeAll():void
Removes all keys and values from this map. | Map | ||
size():uint
Returns the number of items in this map. | Map | ||
toDictionary():Dictionary
Returns this map as a Dictionary. | Map |
keys | property |
keys:List
[read-only] All keys of this map in no particular oder.
public function get keys():List
values | property |
values:List
[read-only] All values of this map in no particular order.
public function get values():List
Map | () | Constructor |
public function Map(dictionary:Dictionary = null)
Creates a new instance.
Parametersdictionary:Dictionary (default = null ) — the dictionry to initially populate the map with
|
clone | () | method |
public function clone():Map
Clones this map. Modifications in the clone are not reflected in the original map and vice versa.
ReturnsMap — a clone of this map
|
containsKey | () | method |
public function containsKey(key:Object):Boolean
Indicates whether this map contains a value mapped to the specified key.
Parameters
key:Object — the key to check
|
Boolean — true if this map contains a value mapped to the specified key
|
containsValue | () | method |
public function containsValue(value:*):Boolean
Indicates whether this map contains the specified value at least once.
Parameters
value:* — the value to check
|
Boolean — true if this map contains the specified value at least once
|
get | () | method |
public function get(key:Object):*
Returns the value mapped to the specified key or undefined.
Parameters
key:Object — the key to return the mapped value for
|
* — the value mapped to the specified key or undefined
|
isEmpty | () | method |
public function isEmpty():Boolean
Indicates whether this map is empty.
ReturnsBoolean — true if this map does not contain any items.
|
put | () | method |
public function put(key:Object, value:*):*
Adds a value for the specified key. If there was already a value mapped for this key, this method will remove it from the map and return it. Otherwise this method returns undefined.
Parameters
key:Object — the key to map the value to
| |
value:* — the value to add
|
* — the value previously mapped to the key or undefined
|
remove | () | method |
public function remove(key:Object):*
Removes and returns the value mapped to the specified key.
Parameters
key:Object — the key to remove from the map
|
* — the value previously mapped to the specified key or undefined
|
removeAll | () | method |
public function removeAll():void
Removes all keys and values from this map.
size | () | method |
public function size():uint
Returns the number of items in this map.
Returnsuint — the number of items in this map
|
toDictionary | () | method |
public function toDictionary():Dictionary
Returns this map as a Dictionary.
ReturnsDictionary — this map as a Dictionary
|