public class IntHash
extends Object
Modifier and Type | Class and Description |
---|---|
private class |
IntHash.Ent
Keeps track of a single entry in the hash table.
|
Modifier and Type | Field and Description |
---|---|
private int |
curSize |
private IntHash.Ent[] |
ents |
private int |
hashSize |
static Tester |
tester
Basic regression test
|
Constructor and Description |
---|
IntHash(int maxSize)
Create the hash table that can comfortably hold the specified number
of entries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int key)
Checks if the hash contains an entry for the given key.
|
Object |
get(int key)
Retrieves the entry for the given key.
|
void |
put(int key,
Object val)
Sets the entry for the given key number.
|
int |
size()
Tells how many entries are currently in the hash table
|
private final int hashSize
private final IntHash.Ent[] ents
private int curSize
public static final Tester tester
public IntHash(int maxSize)
maxSize
- Max # of entriespublic void put(int key, Object val)
public boolean contains(int key)
public Object get(int key)
key
- Key to look forpublic int size()