HashMap

The ‘HashMap’ class stores data in key/value pairs.

See Also

com.boostworthy.collections.ICollection

Summary
HashMapThe ‘HashMap’ class stores data in key/value pairs.
Variables
m_aKeysAn array for storing map keys.
m_aValuesAn array for storing map values.
Functions
HashMapConstructor.
cloneCreates a new hash map that is a clone of this collection.
putAdds a new key and value pair to this collection.
putMapIterates through all accessible properties/elements of the specified object and adds each one as a key/value pair to this collection.
getGets the value that is paired with the specified key.
removeRemoves the specified key and it’s corresponding value from this collection.
containsKeyChecks to see if this collection contains the specified key.
Properties
lengthGets the length of this collection.
Functions
getIteratorReturns an iterator of the specified type.
getKeyIteratorReturns an iterator of the specified type for iterating through keys.
getValueIteratorReturns an iterator of the specified type for iterating through values.
disposePerforms any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
initInitializes this object.
searchForKeySearches through the keys array to see if the key is being stored by this object.

Variables

m_aKeys

protected var m_aKeys: Array

An array for storing map keys.

m_aValues

protected var m_aValues: Array

An array for storing map values.

Functions

HashMap

public function HashMap(objMap: Object = null)

Constructor.

clone

public function clone():HashMap

Creates a new hash map that is a clone of this collection.

Returns

A new hash map that is a clone of this collection. 

put

public function put(objKey: Object,
objValue: Object):void

Adds a new key and value pair to this collection.

Parameters

param objKey The key to use to retrieve the value.
param objValue The value to store. 

putMap

public function putMap(objMap: Object):void

Iterates through all accessible properties/elements of the specified object and adds each one as a key/value pair to this collection.

Parameters

param objMap The object to extract key/value pairs from. 

get

public function get(objKey: Object):Object

Gets the value that is paired with the specified key.  If not such key exists, ‘null’ is returned.

Parameters

param objKey They key to use to retrieve a value. 

Returns

The value that was paired with the specified key. 

remove

public function remove(objKey: Object):void

Removes the specified key and it’s corresponding value from this collection.

Parameters

param objKey The key to be removed. 

containsKey

public function containsKey(objKey: Object):Boolean

Checks to see if this collection contains the specified key.

Parameters

param objKey The key being searched for. 

Returns

A boolean value of ‘true’ if the key exists, ‘false’ if it does not. 

Properties

length

public function get length():uint

Gets the length of this collection.

Returns

The length of this collection. 

Functions

getIterator

public function getIterator(uIterator: uint = 2):IIterator

Returns an iterator of the specified type.

Parameters

param uIterator The iterator type to use for iterating through the data being stored by this collection.  Default is ‘2’ (IteratorType.ARRAY_FORWARD). 

Returns

An iterator instance of the specified type. 

See Also

com.boostworthy.collections.iterators.IteratorType

getKeyIterator

public function getKeyIterator(uIterator: uint = 2):IIterator

Returns an iterator of the specified type for iterating through keys.

Parameters

param uIterator The iterator type to use for iterating through the keys being stored by this collection.  Default is ‘2’ (IteratorType.ARRAY_FORWARD). 

Returns

An iterator instance of the specified type. 

See Also

com.boostworthy.collections.iterators.IteratorType

getValueIterator

public function getValueIterator(uIterator: uint = 2):IIterator

Returns an iterator of the specified type for iterating through values.

Parameters

param uIterator The iterator type to use for iterating through the values being stored by this collection.  Default is ‘2’ (IteratorType.ARRAY_FORWARD). 

Returns

An iterator instance of the specified type. 

See Also

com.boostworthy.collections.iterators.IteratorType

dispose

public function dispose():void

Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.

init

protected function init(objMap: Object):void

Initializes this object.

searchForKey

protected function searchForKey(objKey: Object):int

Searches through the keys array to see if the key is being stored by this object.  If the key is found, it’s index in the keys array is returned.  If the key is not found, the null index value is returned.

Parameters

param objKey The key being searched for. 

Returns

The index that the key is being stored at in the keys array. 

See Also

com.boostworthy.core.Global.NULL_INDEX

A ‘java-style’ collection interface.
The ‘ICollection’ interface defines a common interface for all collection objects.
The ‘IDisposable’ interface defines a common interface for all objects to encorporate garbage collection.
protected var m_aKeys: Array
An array for storing map keys.
protected var m_aValues: Array
An array for storing map values.
public function HashMap(objMap: Object = null)
Constructor.
public function clone():HashMap
Creates a new hash map that is a clone of this collection.
public function put(objKey: Object,
objValue: Object):void
Adds a new key and value pair to this collection.
public function putMap(objMap: Object):void
Iterates through all accessible properties/elements of the specified object and adds each one as a key/value pair to this collection.
public function get(objKey: Object):Object
Gets the value that is paired with the specified key.
public function remove(objKey: Object):void
Removes the specified key and it’s corresponding value from this collection.
public function containsKey(objKey: Object):Boolean
Checks to see if this collection contains the specified key.
public function get length():uint
Gets the length of this collection.
public function getIterator(uIterator: uint = 2):IIterator
Returns an iterator of the specified type.
public function getKeyIterator(uIterator: uint = 2):IIterator
Returns an iterator of the specified type for iterating through keys.
public function getValueIterator(uIterator: uint = 2):IIterator
Returns an iterator of the specified type for iterating through values.
public function dispose():void
Performs any appropriate clean-up tasks for garbage collection such as removing event listeners, setting object references to ‘null’, etc.
protected function init(objMap: Object):void
Initializes this object.
protected function searchForKey(objKey: Object):int
Searches through the keys array to see if the key is being stored by this object.
Close