|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.collections.ChainedTable
public class ChainedTable
A ChainedTable is a chained hash table.
The implementation isn't given here since it is an assignment in a typical
data structures class. In general,
programs should use java.util.HashTable
rather than this ChainedTable.
| Constructor Summary | |
|---|---|
ChainedTable(int tableSize)
Initialize an empty ChainedTable with a specified table size. |
|
| Method Summary | |
|---|---|
boolean |
containsKey(java.lang.Object key)
Determines whether a specified key is in this ChainedTable. |
java.lang.Object |
get(java.lang.Object key)
Retrieves an object for a specified key. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object element)
Add a new element to this ChainedTable, using the specified key. |
java.lang.Object |
remove(java.lang.Object key)
Removes an object for a specified key. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ChainedTable(int tableSize)
tableSize - the table size for this new chained hash table
tableSize > 0
java.lang.OutOfMemoryError - Indicates insufficient memory for the specified table size.
java.lang.IllegalArgumentException - Indicates that tableSize is not positive.| Method Detail |
|---|
public boolean containsKey(java.lang.Object key)
key - the non-null key to look for
key cannot be null.
truefalse otherwise. Note that key.equals( )
is used to compare the key to the keys that are in the
ChainedTable.
java.lang.NullPointerException - Indicates that key is null.public java.lang.Object get(java.lang.Object key)
key - the non-null key to look for
key cannot be null.
keykey.equals( ) is used to compare the key
to the keys that are in the ChainedTable.
java.lang.NullPointerException - Indicates that key is null.
public java.lang.Object put(java.lang.Object key,
java.lang.Object element)
key - the non-null key to use for the new elementelement - the new element that's being added to this ChainedTable
key nor element is null.
key,
then that object is replaced by element, and the return
value is a reference to the replaced object. Otherwise, the new
element is added with the specified key
and the return value is null.
java.lang.NullPointerException - Indicates that key or element is null.public java.lang.Object remove(java.lang.Object key)
key - the non-null key to look for
key cannot be null.
key.equals( ) is used to compare the key
to the keys that are in the ChainedTable.
java.lang.NullPointerException - Indicates that key is null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||