javax.baja.nre.util
Class IntHashMap

java.lang.Object
  extended byjavax.baja.nre.util.IntHashMap

public class IntHashMap
extends java.lang.Object

IntHashMap is an optimized hashtable for hashing objects by an integer keys. It removes the need to use wrapper Integers as with the standard collection classes.


Nested Class Summary
 class IntHashMap.Iterator
           
 
Constructor Summary
IntHashMap()
          Default constructor.
IntHashMap(int initialCapacity)
          Constructor with initial capacity.
IntHashMap(int initialCapacity, float loadFactor)
          Constructor with capacity and load factor.
 
Method Summary
 void clear()
          Clear the hashtable of entries.
 java.lang.Object clone()
          Clone the IntHashMap into a new instance.
 boolean containsKey(int key)
          Get whether the specified key value is defined within the map.
 boolean equals(java.lang.Object obj)
          Return if the specified object another IntHashMap with the exact same key-value pairs.
 java.lang.Object get(int key)
          Get the object identified by the given int key.
 boolean isEmpty()
           
 IntHashMap.Iterator iterator()
           
 java.lang.Object put(int key, java.lang.Object value)
          Put the given object into the table keyed on the int.
 java.lang.Object remove(int key)
          Remove the vaulue identified by the key.
 int size()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
          Get an array containing all values in hash table.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntHashMap

public IntHashMap()
Default constructor.


IntHashMap

public IntHashMap(int initialCapacity)
Constructor with initial capacity.


IntHashMap

public IntHashMap(int initialCapacity,
                  float loadFactor)
Constructor with capacity and load factor.

Method Detail

size

public int size()
Returns:
the count of elements in the table.

isEmpty

public boolean isEmpty()
Returns:
if the table is empty.

iterator

public IntHashMap.Iterator iterator()
Returns:
an iterator of the values for this table.

get

public java.lang.Object get(int key)
Get the object identified by the given int key.

Returns:
null if not in table.

containsKey

public boolean containsKey(int key)
Get whether the specified key value is defined within the map.

Returns:
true if key is defined, false otherwise

put

public java.lang.Object put(int key,
                            java.lang.Object value)
Put the given object into the table keyed on the int.

Returns:
the previous value at this key, or null if it did not have one.

remove

public java.lang.Object remove(int key)
Remove the vaulue identified by the key.

Returns:
the old object at the key, or null if there was no previous object for the key.

clear

public void clear()
Clear the hashtable of entries.


equals

public boolean equals(java.lang.Object obj)
Return if the specified object another IntHashMap with the exact same key-value pairs.


clone

public java.lang.Object clone()
Clone the IntHashMap into a new instance.


toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Get an array containing all values in hash table.