dataStructures
Class HashChains
java.lang.Object
|
+--dataStructures.HashChains
- public class HashChains
- extends java.lang.Object
Method Summary |
java.lang.Object |
get(java.lang.Object theKey)
|
boolean |
isEmpty()
|
static void |
main(java.lang.String[] args)
test method |
void |
output()
output the hash table |
java.lang.Object |
put(java.lang.Object theKey,
java.lang.Object theElement)
insert an element with the specified key
overwrite old element if there is already an
element with the given key |
java.lang.Object |
remove(java.lang.Object theKey)
|
int |
size()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
HashChains
public HashChains(int theDivisor)
isEmpty
public boolean isEmpty()
- Returns:
- true iff the hash table is empty
size
public int size()
- Returns:
- current number of elements in the hash table
get
public java.lang.Object get(java.lang.Object theKey)
- Returns:
- element with specified key
put
public java.lang.Object put(java.lang.Object theKey,
java.lang.Object theElement)
- insert an element with the specified key
overwrite old element if there is already an
element with the given key
- Returns:
- old element (if any) with key theKey
remove
public java.lang.Object remove(java.lang.Object theKey)
- Returns:
- matching element and remove it
output
public void output()
- output the hash table
main
public static void main(java.lang.String[] args)
- test method