public class FastHashMap<K,V>
extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
FastHashMap.Ent<K,V>
Keeps track of a single entry in the hash table.
|
Modifier and Type | Field and Description |
---|---|
private int |
curSize |
private FastHashMap.Ent[] |
ents |
private int |
hashSize |
static Tester |
tester
Basic regression test
|
Constructor and Description |
---|
FastHashMap(int maxSize)
Create the hash table that can comfortably hold the specified number
of entries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(K key)
Checks if the hash contains an entry for the given key.
|
V |
get(K key)
Retrieves the entry for the given key.
|
private int |
hashSlot(K key)
Calculate the hash slot for a given key
|
void |
put(K key,
V 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 FastHashMap.Ent[] ents
private int curSize
public static final Tester tester
public FastHashMap(int maxSize)
maxSize
- Max # of entriespublic void put(K key, V val)
private final int hashSlot(K key)
public boolean contains(K key)
public V get(K key)
key
- Key to look forpublic int size()