|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.search.HashTable<K,V>
algs.model.search.AssociativeHashTable<K,V>
public class AssociativeHashTable<K,V>
HashTable that uses list collision to store objects whose keys collide.
Keys are distinct from the values being stored.
Constructor Summary | |
---|---|
AssociativeHashTable(int tableSize)
Construct initial Hash Table using default hash method that relies on a properly formed hashCode() implementation. |
|
AssociativeHashTable(int tableSize,
IHash<K> hashMethod)
Construct initial Hash Table using desired hash method. |
Method Summary | |
---|---|
V |
add(K k,
V v)
Associate element v with key k. |
V |
remove(K k)
Remove the entry from the hash table. |
java.lang.String |
report()
Every Hash Table has the ability to report interesting statistics about itself. |
boolean |
search(K k)
Search for the desired value in the HashTable. |
Methods inherited from class algs.model.search.HashTable |
---|
remove, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AssociativeHashTable(int tableSize, IHash<K> hashMethod)
tableSize
- desired size.hashMethod
- method to use when hashing elements.public AssociativeHashTable(int tableSize)
tableSize
- desired size.Method Detail |
---|
public boolean search(K k)
Only succeeds if V overrides the equals (Object o) method
k
- the searched-for key
true
if element v is found in the HashTable; false
otherwise.public V add(K k, V v)
IHashtableAccess
k
- key to be added to the Hash table entriesv
- target item to be associated with the key
null
if no such element associated in the Hash Table
with the given key; otherwise returns V objects that was previously associated
with that object.public V remove(K k)
IHashtableAccess
k
- key of target item to be removed.
null
otherwise.public java.lang.String report()
HashTable
Defined by subclasses
report
in class HashTable<K,V>
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |