| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
An object that maps keys to values. A map cannot contain duplicate keys;
each key can map to at most one value.
The "destructive" methods contained in this interface, that is, the
methods that modify the map on which they operate, are specified to throw
UnsupportedOperationException if this map does not support the
operation. If this is the case, these methods may, but are not required
to, throw an UnsupportedOperationException if the invocation would
have no effect on the map. For example, invoking the putAll(Map)
method on an unmodifiable map may, but is not required to, throw the
exception if the map whose mappings are to be "superimposed" is empty.
Some map implementations have restrictions on the keys and values they
may contain. For example, some implementations prohibit null keys and
values, and some have restrictions on the types of their keys. Attempting
to insert an ineligible key or value throws an unchecked exception,
typically NullPointerException or ClassCastException.
Attempting to query the presence of an ineligible key or value may throw an
exception, or it may simply return false; some implementations will exhibit
the former behavior and some will exhibit the latter. More generally,
attempting an operation on an ineligible key or value whose completion
would not result in the insertion of an ineligible element into the map may
throw an exception or it may succeed, at the option of the implementation.
Such exceptions are marked as "optional" in the specification for this
interface.
Many methods in Collections Framework interfaces are defined
in terms of the === operator. For example, the
specification for the containsKey( key : Object )
method says: "returns true if and
only if this map contains a mapping for a key k such that
key === k." This specification should
not be construed to imply that invoking HashMap.containsKey
with a non-null argument key will cause key === k to
be invoked for any key k. Implementations are free to
implement optimizations whereby the === invocation is avoided,
for example, by first comparing the hash codes of the two keys. (The
HashCodeFactory.getKey(Object) specification guarantees that two
objects with unequal hash codes cannot be equal.) More generally, implementations of
the various Collections Framework interfaces are free to take advantage of
the specified behavior of underlying Object methods wherever the
implementor deems it appropriate.
protected var _n:uint
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Number of mappings currently in this map
protected var _oKeyDico:Dictionary
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
A dictionnary which stores the mapping (key - value)
for this map.
protected var _oValueDico:Dictionary
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
A dictionnary which store the mapping (value -
occurrences count) for this map.
public function HashMap()
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Creates a new empty hash map object.
protected function _init():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Realize the concret initialization for this map
public function clear():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes all of the mappings from this map (optional operation).
The map will be empty after this call returns.
public function containsKey(key:*):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this map contains a mapping for the specified
key. More formally, returns true if and only if
this map contains a mapping for a key k such that
key === k. (There can be at most one such mapping.)
Parameters
| key:* — key object whose presence in this map is to be tested
|
Returns
| Boolean — true if this map contains a mapping for the specified
key
|
Throws
| — NullPointerException — if the specified key is null
|
public function containsValue(value:*):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this map maps one or more keys to the
specified value. More formally, returns true if and only if
this map contains at least one mapping to a value v such that
(value === v).
Parameters
| value:* — value whose presence in this map is to be tested
|
Returns
| Boolean — true if this map maps one or more keys to the
specified value
|
public function get(key:*):*
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the value to which the specified key is mapped,
or null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value v such that
(key === k), then this method returns v; otherwise
it returns null. (There can be at most one such mapping.)
As this map permits null values, a return value of null
does not necessarily indicate that the map contains no mapping
for the key; it's also possible that the map explicitly maps the key to
null. The containsKey operation may be used
to distinguish these two cases.
Parameters
| key:* — the key whose associated value is to be returned
|
Returns
| * — the value to which the specified key is mapped, or
null if this map contains no mapping for the key
|
Throws
| — NullPointerException — if the specified key is null
|
public function getKeys():Array
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns an Array view of the keys contained in this map.
Returns
| Array — an array view of the keys contained in this map
|
public function getValues():Array
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns an Array view of the values contained in this map.
Returns
| Array — an array view of the values contained in this map
|
public function isEmpty():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if this map contains no key-value mappings.
Returns
| Boolean — true if this map contains no key-value mappings
|
public function put(key:*, value:*):*
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Associates the specified value with the specified key in this map
(optional operation). If the map previously contained a mapping for
the key, the old value is replaced by the specified value. (A map
m is said to contain a mapping for a key k
if and only if m.containsKey(k) would return
true.)
Parameters
| key:* — key with which the specified value is to be associated
|
| |
| value:* — value to be associated with the specified key
|
Returns
| * — the previous value associated with key, or
null if there was no mapping for key.
(A null return can also indicate that the map
previously associated null with key,
if the implementation supports null values.)
|
Throws
| — NullPointerException — if the specified key or value is null
|
public function remove(key:*):*
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes the mapping for a key from this map if it is present
(optional operation). More formally, if this map contains a mapping
from key k to value v such that
(key === k), that mapping is removed.
(The map can contain at most one such mapping.)
Returns the value to which this map previously associated the key,
or null if the map contained no mapping for the key.
As this map permits null values, then a return value of
null does not necessarily indicate that the map
contained no mapping for the key; it's also possible that the map
explicitly mapped the key to null.
The map will not contain a mapping for the specified key once the
call returns.
Parameters
| key:* — key whose mapping is to be removed from the map
|
Returns
| * — the previous value associated with key, or
null if there was no mapping for key.
|
Throws
| — NullPointerException — if the specified key is null
|
public function size():Number
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the number of key-value mappings in this map.
Returns
| Number — the number of key-value mappings in this map
|
public function toString():String
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the string representation of this instance.
Returns
| String — the string representation of this instance
|
LowRA API documentation 2008- 2009
Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1
mer. févr. 25 2009, 9:22 AM GMT+01:00