|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--HashTable
Class HashTable is a simple hash table example, as discussed in CSC 103 lecture notes week 5 and week 5, part 2 . Entries in a HashTable must implement the HashTableEntry interface.
| Field Summary | |
protected int |
DEFAULT_SIZE
Default table size if zero-argument constructor is used |
protected HashTableEntry |
lastEntry
Reference to most recent entry, for use by lookup and delete |
protected int |
size
Table size |
protected HashTableEntry[] |
table
The table array |
| Constructor Summary | |
HashTable()
Construct an empty table of the default size of 1000 entries. |
|
HashTable(int size)
Construct an empty table of the given size. |
|
| Method Summary | |
HashTable |
enter(HashTableEntry entry)
Enter the given entry into this table if an entry of the same key is not already in the table. |
HashTableEntry |
lookup(java.lang.Object key)
Lookup the entry of the given key. |
java.lang.String |
toString()
Return this as a newline-delimited string of the form Entry 0: value ... |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final int DEFAULT_SIZE
protected final int size
protected HashTableEntry[] table
protected HashTableEntry lastEntry
| Constructor Detail |
public HashTable()
public HashTable(int size)
| Method Detail |
public HashTable enter(HashTableEntry entry)
throws HashTableFull,
HashIndexInvalid
public HashTableEntry lookup(java.lang.Object key)
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||