Source of SetInterface.java


  1: /**
  2:    An interface that describes the operations of a set of objects.
  3:    
  4:    @author Charles Hoot, Frank M. Carrano, Timothy M. Henry
  5:    @version 5.0
  6: */
  7: public interface SetInterface<T>
  8: {
  9:         public int getCurrentSize();
 10:          public boolean isEmpty();
 11:    
 12:         /** Adds a new entry to this set, avoiding duplicates.
 13:             @param newEntry  The object to be added as a new entry.
 14:             @return  True if the addition is successful, or 
 15:                 false if the item already is in the set. */
 16:         public boolean add(T newEntry);

 18:         /** Removes a specific entry from this set, if possible.
 19:        @param anEntry  The entry to be removed.
 20:        @return  True if the removal was successful, or false if not. */
 21:         public boolean remove(T anEntry);
 22:    
 23:         public T remove();
 24:         public void clear();
 25:         public boolean contains(T anEntry);
 26:         public T[] toArray();
 27: } // end SetInterface