gnu.kawa.util
Class GeneralHashTable
java.lang.Object
gnu.kawa.util.GeneralHashTable
public class GeneralHashTable
extends java.lang.Object
A generic hash table.
Supports deletions, and re-allocates the table when too big.
The equivalence relation can be customized.
num_bindings
protected int num_bindings
GeneralHashTable
public GeneralHashTable()
GeneralHashTable
public GeneralHashTable(int capacity)
get
public Object get(Object key,
Object defaultValue)
getNode
public HashNode getNode(Object key)
hash
public int hash(Object key)
Calculate hash code of a key.
You may need to override this if you override the matches
method.
makeEntry
protected HashNode makeEntry(Object key,
int hash,
Object value)
Allocate a new node in the hash table.
matches
public boolean matches(Object value1,
Object value2)
Compare two keys for equivalence.
Override this and the
hash(Object)
method if you want
a different equivalence relation.
matches
public boolean matches(Object key,
int hash,
HashNode node)
put
public Object put(Object key,
Object value)
put
public Object put(Object key,
int hash,
Object value)
rehash
protected void rehash()
remove
public Object remove(Object key)