| Package | de.polygonal.ds |
| Class | public class HashMap |
| Inheritance | HashMap Object |
| Implements | Collection |
| Property | Defined By | ||
|---|---|---|---|
| size : int [read-only]
The total number of items. | HashMap | ||
| Method | Defined By | ||
|---|---|---|---|
HashMap(size:int = 500)
Initializes a new HashMap instance. | HashMap | ||
clear():void
Clears all items. | HashMap | ||
contains(obj:*):Boolean
Determines if the collection contains a given item. | HashMap | ||
containsKey(key:*):Boolean
Checks if a mapping exists for the given key. | HashMap | ||
dump():String
Prints out all elements (for debug/demo purposes). | HashMap | ||
find(key:*):*
Finds the value that is associated with the given key. | HashMap | ||
Initializes an iterator object pointing to the first item in the
collection. | HashMap | ||
getKeySet():Array
Writes all keys into an array. | HashMap | ||
insert(key:*, obj:*):Boolean
Inserts a key/data couple into the table. | HashMap | ||
isEmpty():Boolean
Checks if the collection is empty. | HashMap | ||
remove(key:*):*
Removes a value based on a given key. | HashMap | ||
toArray():Array
Converts the collection into an array. | HashMap | ||
toString():String
Prints out a string representing the current object. | HashMap | ||
| size | property |
size:int [read-only] The total number of items.
public function get size():int| HashMap | () | Constructor |
public function HashMap(size:int = 500)Initializes a new HashMap instance.
Parameterssize:int (default = 500) — The initial capacity of the HashMap.
|
| clear | () | method |
public function clear():voidClears all items.
| contains | () | method |
public function contains(obj:*):BooleanDetermines if the collection contains a given item.
Parameters
obj:* — The item to search for.
|
Boolean — True if the item exists, otherwise false.
|
| containsKey | () | method |
public function containsKey(key:*):BooleanChecks if a mapping exists for the given key.
Parameters
key:* |
Boolean — True if key exists, otherwise false.
|
| dump | () | method |
public function dump():StringPrints out all elements (for debug/demo purposes).
ReturnsString — A human-readable representation of the structure.
|
| find | () | method |
public function find(key:*):*Finds the value that is associated with the given key.
Parameters
key:* — The key mapping a value.
|
* — The data associated with the key or null if no matching
entry was found.
|
| getIterator | () | method |
public function getIterator():IteratorInitializes an iterator object pointing to the first item in the collection.
ReturnsIterator — An iterator object.
|
| getKeySet | () | method |
public function getKeySet():ArrayWrites all keys into an array.
ReturnsArray — An array containing all keys.
|
| insert | () | method |
public function insert(key:*, obj:*):BooleanInserts a key/data couple into the table.
Parameters
key:* — The key.
| |
obj:* — The data associated with the key.
|
Boolean |
| isEmpty | () | method |
public function isEmpty():BooleanChecks if the collection is empty.
ReturnsBoolean — True if empty, otherwise false.
|
| remove | () | method |
public function remove(key:*):*Removes a value based on a given key.
Parameters
key:* — The entry's key.
|
* — The data associated with the key or null if no matching
entry was found.
|
| toArray | () | method |
public function toArray():ArrayConverts the collection into an array.
ReturnsArray — An array.
|
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|