public class ExternalChainingHashTable<K,V>
extends java.lang.Object
Constructor and Description |
---|
ExternalChainingHashTable()
Construct the hash table.
|
ExternalChainingHashTable(int size)
Construct the hash table.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(K key)
Search for an item in the hash table.
|
V |
get(K key)
Find an item in the hash table.
|
static int |
hashString(java.lang.String key,
int tableSize)
A hash routine for String objects.
|
static void |
main(java.lang.String[] args) |
void |
put(K key,
V value)
Insert into the hash table.
|
void |
remove(K key)
Remove from the hash table.
|
public ExternalChainingHashTable()
public ExternalChainingHashTable(int size)
size
- approximate table size.public void put(K key, V value)
key
- the item to insert.public void remove(K key)
key
- the item to remove.public V get(K key)
key
- the item to search for.public boolean contains(K key)
key
- the item to search for.public static int hashString(java.lang.String key, int tableSize)
key
- the String to hash.tableSize
- the size of the hash table.public static void main(java.lang.String[] args)