Packagecom.yworks.bridge.util
Classpublic class HashMap
InheritanceHashMap Inheritance AbstractMap Inheritance YObject Inheritance Object
Implements Map, Clonable

HashMap is an implementation of Map. All optional operations are supported, adding and removing. Keys and values can be any objects.



Public Properties
 PropertyDefined By
  empty : Boolean
[override] [read-only] Answers if this HashMap has no elements, a size of zero.
HashMap
Public Methods
 MethodDefined By
  
HashMap(init:Boolean = true)
Constructs a new empty instance of HashMap.
HashMap
  
clear():void
[override] Removes all mappings from this HashMap, leaving it empty.
HashMap
  
clone():Object
[override] Answers a new HashMap with the same mappings and size as this HashMap.
HashMap
  
containsKey(key:Object):Boolean
[override] Searches this HashMap for the specified key.
HashMap
  
containsValue(value:Object):Boolean
[override] Searches this HashMap for the specified value.
HashMap
  
[override] Answers a Set of the mappings contained in this HashMap.
HashMap
 Inherited
equals(object:Object):Boolean
[override] Compares the specified object to this Map and answer if they are equal.
AbstractMap
  
getClass():Class
[override]
HashMap
  
getValue(key:Object):Object
[override] Answers the value of the mapping with the specified key.
HashMap
 Inherited
hashCode():int
[override] Answers an integer hash code for the receiver.
AbstractMap
  
[override] Answers a Set of the keys contained in this HashMap.
HashMap
  
[static] Constructs a new empty instance of HashMap.
HashMap
  
newHashMap2(capacity:int):HashMap
[static] Constructs a new instance of HashMap with the specified capacity.
HashMap
  
[static] Constructs a new instance of HashMap containing the mappings from the specified Map.
HashMap
  
newHashMap4(capacity:int, loadFactor:Number):HashMap
[static] Constructs a new instance of HashMap with the specified capacity and load factor.
HashMap
  
putAll(map:Map):void
[override] Copies all the mappings in the given map to this map.
HashMap
  
putValue(key:Object, value:Object):Object
[override] Maps the specified key to the specified value.
HashMap
  
remove(key:Object):Object
[override] Removes a mapping with the specified key from this HashMap.
HashMap
  
size():int
[override] Answers the number of mappings in this HashMap.
HashMap
 Inherited
toString():String
Answers the string representation of this Map.
AbstractMap
  
[override] Answers a Collection of the values contained in this HashMap.
HashMap
Protected Methods
 MethodDefined By
  
cloneImpl(o:Object):void
[override]
HashMap
 Inherited
AbstractMap
  
Initializes this object.
HashMap
  
initHashMap2(capacity:int):void
Initializes this object.
HashMap
  
initHashMap3(map:Map):void
Initializes this object.
HashMap
  
initHashMap4(capacity:int, loadFactor:Number):void
Initializes this object.
HashMap
Property Detail
emptyproperty
empty:Boolean  [read-only] [override]

Answers if this HashMap has no elements, a size of zero.


Implementation
    public function get empty():Boolean

See also

Constructor Detail
HashMap()Constructor
public function HashMap(init:Boolean = true)

Constructs a new empty instance of HashMap.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
clear()method
override public function clear():void

Removes all mappings from this HashMap, leaving it empty.

See also

clone()method 
override public function clone():Object

Answers a new HashMap with the same mappings and size as this HashMap.

Returns
Object — a shallow copy of this HashMap

See also

cloneImpl()method 
override protected function cloneImpl(o:Object):void

Parameters

o:Object

containsKey()method 
override public function containsKey(key:Object):Boolean

Searches this HashMap for the specified key.

Parameters

key:Object — the object to search for

Returns
Boolean — true if key is a key of this HashMap, false otherwise
containsValue()method 
override public function containsValue(value:Object):Boolean

Searches this HashMap for the specified value.

Parameters

value:Object — the object to search for

Returns
Boolean — true if value is a value of this HashMap, false otherwise
entrySet()method 
override public function entrySet():Set

Answers a Set of the mappings contained in this HashMap. Each element in the set is a Map.Entry. The set is backed by this HashMap so changes to one are reflected by the other. The set does not support adding.

Returns
Set — a Set of the mappings
getClass()method 
override public function getClass():Class

Returns
Class
getValue()method 
override public function getValue(key:Object):Object

Answers the value of the mapping with the specified key.

Parameters

key:Object — the key

Returns
Object — the value of the mapping with the specified key
initHashMap1()method 
protected final function initHashMap1():void

Initializes this object. See the documentation of the corresponding factory method newHashMap1() for details.

See also

initHashMap2()method 
protected final function initHashMap2(capacity:int):void

Initializes this object. See the documentation of the corresponding factory method newHashMap2() for details.

Parameters

capacity:int

See also

initHashMap3()method 
protected final function initHashMap3(map:Map):void

Initializes this object. See the documentation of the corresponding factory method newHashMap3() for details.

Parameters

map:Map

See also

initHashMap4()method 
protected final function initHashMap4(capacity:int, loadFactor:Number):void

Initializes this object. See the documentation of the corresponding factory method newHashMap4() for details.

Parameters

capacity:int
 
loadFactor:Number

See also

keySet()method 
override public function keySet():Set

Answers a Set of the keys contained in this HashMap. The set is backed by this HashMap so changes to one are reflected by the other. The set does not support adding.

Returns
Set — a Set of the keys
newHashMap1()method 
public static function newHashMap1():HashMap

Constructs a new empty instance of HashMap.

Returns
HashMap
newHashMap2()method 
public static function newHashMap2(capacity:int):HashMap

Constructs a new instance of HashMap with the specified capacity.

Parameters

capacity:int — the initial capacity of this HashMap

Returns
HashMap

Throws
IllegalArgumentException — when the capacity is less than zero
newHashMap3()method 
public static function newHashMap3(map:Map):HashMap

Constructs a new instance of HashMap containing the mappings from the specified Map.

Parameters

map:Map — the mappings to add

Returns
HashMap
newHashMap4()method 
public static function newHashMap4(capacity:int, loadFactor:Number):HashMap

Constructs a new instance of HashMap with the specified capacity and load factor.

Parameters

capacity:int — the initial capacity
 
loadFactor:Number — the initial load factor

Returns
HashMap

Throws
IllegalArgumentException — when the capacity is less than zero or the load factor is less or equal to zero
putAll()method 
override public function putAll(map:Map):void

Copies all the mappings in the given map to this map. These mappings will replace all mappings that this map had for any of the keys currently in the given map.

Parameters

map:Map — the Map to copy mappings from


Throws
ReferenceError — if the given map is null
putValue()method 
override public function putValue(key:Object, value:Object):Object

Maps the specified key to the specified value.

Parameters

key:Object — the key
 
value:Object — the value

Returns
Object — the value of any previous mapping with the specified key or null if there was no mapping
remove()method 
override public function remove(key:Object):Object

Removes a mapping with the specified key from this HashMap.

Parameters

key:Object — the key of the mapping to remove

Returns
Object — the value of the removed mapping or null if key is not a key in this HashMap
size()method 
override public function size():int

Answers the number of mappings in this HashMap.

Returns
int — the number of mappings in this HashMap
values()method 
override public function values():Collection

Answers a Collection of the values contained in this HashMap. The collection is backed by this HashMap so changes to one are reflected by the other. The collection does not support adding.

Returns
Collection — a Collection of the values