K
- the type of the key.V
- values stored.public class Hashtable<K,V>
extends java.lang.Object
Constructor and Description |
---|
Hashtable() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(K key)
Returns true if the key is contained in the table, false otherwise.
|
V |
get(K key)
Retrieves the object associated with this key.
|
int |
getPositionInHashtable(K key)
This method should tell you where in the hashtable this key will be stored, ASSUMING NO COLLISIONS.
|
int |
numCollisions()
Returns the number of times a collision has occurred.
|
int |
numEntries()
Returns the number of things actually stored in this hashtable.
|
int |
numSlots()
Returns the size of the array used to back your hashtable.
|
void |
put(K key,
V value)
Puts a key value pair in the hashtable.
|
public V get(K key)
key
- Key we're using for retrievalpublic boolean containsKey(K key)
key
- Key we're looking forpublic void put(K key, V value)
key
- The key used for retreival latervalue
- Corresponding value.public int numSlots()
public int numEntries()
public int numCollisions()
public int getPositionInHashtable(K key)
key
- The key we're trying to figure out where to store