csc241.samples.Set
Class hashTable

java.lang.Object
  |
  +--csc241.samples.Set.hashTable
All Implemented Interfaces:
Set

public class hashTable
extends java.lang.Object
implements Set


Constructor Summary
hashTable(int arraySize)
          Construct an empty hashTable with an array with the array size given
 
Method Summary
 void add(java.lang.Comparable e)
          add an element to the hashTable.
 void dump()
          The the content of the hash table is displayed in the form of a table with chains starting from each cell.
 java.lang.Comparable find(java.lang.Comparable e)
          find and return the element in the hashTable or return null e - the element to be searched for
 void remove(java.lang.Comparable e)
          remove an element from the hashTable; do nothing if element is not there.
e - the element to be removed
 int size()
          return the size of the hashTable (i.e.
 java.lang.Comparable[] toArray()
          The toArray method creates and returns an array containing all elements in the hashTable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

hashTable

public hashTable(int arraySize)
Construct an empty hashTable with an array with the array size given
Method Detail

add

public void add(java.lang.Comparable e)
add an element to the hashTable. Do nothing if element is already in the Set
e - the Comparable Object to be added
Specified by:
add in interface Set

remove

public void remove(java.lang.Comparable e)
remove an element from the hashTable; do nothing if element is not there.
e - the element to be removed
Specified by:
remove in interface Set

find

public java.lang.Comparable find(java.lang.Comparable e)
find and return the element in the hashTable or return null e - the element to be searched for
Specified by:
find in interface Set

size

public int size()
return the size of the hashTable (i.e. the number of elements in the set).
Specified by:
size in interface Set

dump

public void dump()
The the content of the hash table is displayed in the form of a table with chains starting from each cell.
Specified by:
dump in interface Set

toArray

public java.lang.Comparable[] toArray()
The toArray method creates and returns an array containing all elements in the hashTable.
Specified by:
toArray in interface Set