tyrex.util
public final class HashIntTable extends Object
Constructor Summary | |
---|---|
HashIntTable()
Create the HashIntTable using the default
size | |
HashIntTable(int size, int defaultValue)
Create the HashIntTable with the specified
size.
|
Method Summary | |
---|---|
int | get(Object key)
Get the value of the specified key. |
int | increment(Object key, int increment)
Increment the value associated with the specified key
by the specified amount.
|
Enumeration | keys()
Return the enumeration of keys.
|
static void | main(String[] args) |
int | put(Object key, int value)
Associate the specified key with the
specified value.
|
int | remove(Object key)
Remove the value for specified key
|
int | size()
Return the size of the HashIntTable.
|
Parameters: size the size (must be greater than zero)
Parameters: key the key. Cannot be null.
Returns: the value of the key in the table
Parameters: key the key. Cannot be null increment the increment
Returns: the incremented value
If the size of the HashIntTable changes (via put, remove, increment) while the keys are being enuemrated a ConcurrentModificationException is thrown by the enumeration.
Returns: the enumeration of keys.
Parameters: key the key. Cannot be null value the new value
Returns: the existing value. If the key does not exist in the table return the default value.
Parameters: key the key. Cannot be null.
Returns: the old value. If the key does not exist in the table return the default value.
Returns: the size of the HashIntTable.