package jds; import jds.Collection; /** * Bag - simple collection with insertion, removal, and test; * for use with book * Classic Data Structures * in Java * by Timothy A Budd, * published by Addison-Wesley, 2001. * * @author Timothy A. Budd * @version 1.1 September 1999 * @see jds.Collection */ public interface Bag extends Collection { /** * add a new value to the collection * * @param value element to be inserted into collection */ public void addElement (Object value); /** * see if collection contains value * * @param value element to be tested * @return true if collection contains value */ public boolean containsElement (Object value); /** * find element that will test equal to value * * @param value element to be tested * @return first value that is equals to argument * @exception java.util.NoSuchElementException no matching value */ public Object findElement (Object value); /** * remove a new value from the collection * * @param value element to be removed from collection * @exception java.util.NoSuchElementException no matching value */ public void removeElement (Object value); }