/** * interface SetInterface * Defines the interface to a set collection * * @author rpj * @version 12ix08 */ import java.util.Iterator; public interface SetInterface { /** Adds one element to this set, ignoring duplicates. */ public void add (T element); /** Removes and returns a random element from this set. */ public T removeRandom () throws EmptySetException; /** Removes and returns the specified element from this set. */ public T remove (T element) throws NoSuchElementException; /** Returns true if this set contains the parameter */ public boolean contains (T target); /** Returns true if this set and the parameter contain exactly the same elements */ public boolean equals (SetInterface set); /** Returns true if this set contains no elements */ public boolean isEmpty(); /** Returns the number of elements in this set */ public int size(); /** Returns an iterator for the elements in this set */ public Iterator iterator(); /** Returns a string representation of this set */ public String toString(); /** Forms the union of this set and the parameter */ public void union (SetInterface set); /** Forms the intersection of this set and the parameter */ public void intersection(SetInterface set); /** Returns true if this set is a subset of the parameter */ public boolean subset(SetInterface set); /** Forms the set difference of this and the parameter. * * That is the set of elements in here but not in the parameter set */ public void diff(SetInterface set); }