abstract class AbstractHashMapRVM<K,V> extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AbstractHashMapRVM.AbstractBucket<K,V> |
private class |
AbstractHashMapRVM.BucketIterator
Iterator types for key and value
|
private class |
AbstractHashMapRVM.KeyIterator |
private class |
AbstractHashMapRVM.ValueIterator |
Modifier and Type | Field and Description |
---|---|
protected AbstractHashMapRVM.AbstractBucket<K,V>[] |
buckets |
protected static int |
DEFAULT_SIZE |
private static float |
LOAD |
protected int |
numElems |
Constructor and Description |
---|
AbstractHashMapRVM(int size) |
Modifier and Type | Method and Description |
---|---|
private int |
bucketIndex(K key,
int divisor) |
(package private) abstract AbstractHashMapRVM.AbstractBucket<K,V> |
createNewBucket(K k,
V v,
AbstractHashMapRVM.AbstractBucket<K,V> n) |
V |
get(K key) |
private void |
growMap() |
private boolean |
growMapAllowed()
Advise against growing the buckets if they are immortal, as it will lead
to multiple sets of buckets that will be scanned.
|
(package private) abstract int |
hashTheKey(K key) |
Iterator<K> |
keyIterator() |
Iterable<K> |
keys() |
private AbstractHashMapRVM.AbstractBucket<K,V>[] |
newBucketArray(int size) |
V |
put(K key,
V value) |
V |
remove(K key) |
void |
removeAll() |
(package private) abstract boolean |
same(K key1,
K key2) |
int |
size() |
Iterator<V> |
valueIterator() |
Iterable<V> |
values() |
protected static final int DEFAULT_SIZE
private static final float LOAD
protected AbstractHashMapRVM.AbstractBucket<K,V>[] buckets
protected int numElems
AbstractHashMapRVM(int size)
abstract int hashTheKey(K key)
abstract AbstractHashMapRVM.AbstractBucket<K,V> createNewBucket(K k, V v, AbstractHashMapRVM.AbstractBucket<K,V> n)
public final int size()
private boolean growMapAllowed()
private AbstractHashMapRVM.AbstractBucket<K,V>[] newBucketArray(int size)
private void growMap()
public void removeAll()
public final Iterator<V> valueIterator()
public final Iterator<K> keyIterator()
private int bucketIndex(K key, int divisor)
public final Iterable<V> values()