csc241.samples.Set
Interface Set

All Known Implementing Classes:
hashTable, Tree

public interface Set


Method Summary
 void add(java.lang.Comparable e)
          add an element to the set.
 void dump()
          The dump method has been added for debugging purposes and each class implementing this interface will display its content in its own way using system.out.
 java.lang.Comparable find(java.lang.Comparable e)
          find and return the element in the set or return null if the element is not in the set.
 void remove(java.lang.Comparable e)
          remove an element from the set.
 int size()
          return the size of the set (i.e.
 java.lang.Comparable[] toArray()
          The toArray method creates and returns an array containing all elements in the set.
 

Method Detail

add

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

remove

public void remove(java.lang.Comparable e)
remove an element from the set. Do nothing if element no in the Set.
e - the element to be removed

find

public java.lang.Comparable find(java.lang.Comparable e)
find and return the element in the set or return null if the element is not in the set.
e - the element to be searched for

size

public int size()
return the size of the set (i.e. the number of elements in the set).

dump

public void dump()
The dump method has been added for debugging purposes and each class implementing this interface will display its content in its own way using system.out.

toArray

public java.lang.Comparable[] toArray()
The toArray method creates and returns an array containing all elements in the set.