|
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<V,V>
algs.model.search.ListHashTable<V>
public class ListHashTable<V>
HashTable that uses list collision to store objects whose keys collide.
Stores the objects as the keys themselves.
| Constructor Summary | |
|---|---|
ListHashTable(int tableSize)
Construct initial Hash Table using default hash method that relies on a properly formed hashCode() implementation. |
|
ListHashTable(int tableSize,
IHash<V> hashMethod)
Construct initial Hash Table using desired hash method. |
|
| Method Summary | |
|---|---|
void |
add(V k)
ListHashTable objects add elements who are themselves keys. |
V |
add(V k,
V v)
Associate element v with key k. |
void |
load(java.util.Iterator<V> it)
Bulk load elements into the Hash Table from the Iterator. |
V |
remove(V v)
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(V v)
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 ListHashTable(int tableSize,
IHash<V> hashMethod)
tableSize - desired size.hashMethod - method to use when hashing elements.public ListHashTable(int tableSize)
tableSize - desired size.| Method Detail |
|---|
public boolean search(V v)
Only succeeds if V overrides the equals (Object o) method
v - the searched-for value
true if element v is found in the HashTable; false
otherwise.public void load(java.util.Iterator<V> it)
it - Iterator of the elements to be added into the Hash Table.public void add(V k)
k - the key (and value) of the element to be added.
public V add(V 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(V v)
IHashtableAccess
v - key of target item to be removed.
null otherwise.public java.lang.String report()
HashTableDefined by subclasses
report in class HashTable<V,V>
|
Algorithm Development Kit 1.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||