public class FastIntCache
extends Object
Modifier and Type | Field and Description |
---|---|
private IntHash |
newHash |
private IntHash |
oldHash |
private int |
size |
static Tester |
tester
Basic regression test
|
Constructor and Description |
---|
FastIntCache(int size)
Construct a new cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all entries from the cache
|
boolean |
contains(int key)
Check whether the given key is present in the cache
|
Object |
get(int key)
Retrieve the value for the given key, or null if not found.
|
void |
put(int key,
Object val)
Add a key/value pair to the cache.
|
private int size
private IntHash oldHash
private IntHash newHash
public static final Tester tester
public FastIntCache(int size)
size
- How large to make each of the two internal hash tables.public void clear()
public boolean contains(int key)
public Object get(int key)
public void put(int key, Object val)