public class ChainHashMapOld<K,V> extends AbstractHashMap<K,V>
AbstractMap.MapEntry<K,V>capacity, n| Constructor and Description |
|---|
ChainHashMapOld()
Creates a hash table with capacity 11 and prime factor 109345121.
|
ChainHashMapOld(int cap)
Creates a hash table with given capacity and prime factor 109345121.
|
ChainHashMapOld(int cap,
int p)
Creates a hash table with the given capacity and prime factor.
|
| Modifier and Type | Method and Description |
|---|---|
protected V |
bucketGet(int h,
K k)
Returns value associated with key k in bucket with hash value h.
|
protected V |
bucketPut(int h,
K k,
V v)
Associates key k with value v in bucket with hash value h, returning
the previously associated value, if any.
|
protected V |
bucketRemove(int h,
K k)
Removes entry having key k from bucket with hash value h, returning
the previously associated value, if found.
|
protected void |
createTable()
Creates an empty table having length equal to current capacity.
|
Iterable<Entry<K,V>> |
entrySet()
Returns an iterable collection of all key-value entries of the map.
|
get, put, remove, sizeisEmpty, keySet, valuespublic ChainHashMapOld()
public ChainHashMapOld(int cap)
public ChainHashMapOld(int cap,
int p)
protected void createTable()
AbstractHashMapcreateTable in class AbstractHashMap<K,V>protected V bucketGet(int h, K k)
AbstractHashMapbucketGet in class AbstractHashMap<K,V>h - the hash value of the relevant bucketk - the key of interestprotected V bucketPut(int h, K k, V v)
AbstractHashMapbucketPut in class AbstractHashMap<K,V>h - the hash value of the relevant bucketk - the key of interestv - the value to be associatedprotected V bucketRemove(int h, K k)
AbstractHashMapbucketRemove in class AbstractHashMap<K,V>h - the hash value of the relevant bucketk - the key of interest