mmap
Class IntHashtable
java.lang.Object
|
+--mmap.IntHashtable
- public class IntHashtable
- extends java.lang.Object
Hashtable used to store objects.
Elements are stored inside the hashtable using an integer rather than another
object as key to speedup performances.
The behaviour resemples the java.util.Hastable, not everything was
rewritten but this class is also synchronized.
This class was written starting from the source of java.util.Hashtable
of SUN distributed with JDK 1.2
- Version:
- 1.0 June 05 2000
- Author:
- Dario Maggiorini (dario@dsi.unimi.it)
Constructor Summary |
IntHashtable()
Create an empty hash with default load factors. |
Method Summary |
java.lang.Object |
get(int key)
Get an object from the table. |
java.lang.Object |
put(int key,
java.lang.Object value)
Add an object in the table. |
protected void |
rehash()
Internal, used to rebalance the hash table. |
java.lang.Object |
remove(int key)
Remove an object from the table. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
IntHashtable
public IntHashtable()
- Create an empty hash with default load factors.
get
public java.lang.Object get(int key)
- Get an object from the table.
The object associated to the key is returned.
- Returns:
- the object found or null if no object was found
put
public java.lang.Object put(int key,
java.lang.Object value)
throws java.lang.NullPointerException
- Add an object in the table.
The null object is not supported.
- Parameters:
key
- the key associated to the objectvalue
- the object to insert- Returns:
- the old object if the key where already present in the
table or null otherwise.
remove
public java.lang.Object remove(int key)
- Remove an object from the table.
- Parameters:
key
- the key associated to the object- Returns:
- the old object if the key where present in the
table or null otherwise.
rehash
protected void rehash()
- Internal, used to rebalance the hash table.
used to extend the table when it's full.
v1.0 beta by Dario Maggiorini