/** * ADT: BagIdea * Description: The idea for a Bag structure * Notes: * 1) Also see super-ADT * 2) The (inherited) "toNativeList" returns list where order does * not matter (can be in ANY order) */ //Super (Parent) ADT: SpecializedStructureIdea (all methods in super are inherited by BagIdea) ADT: BagIdea { /** * Returns true if structure contains matching element (where searchFct outputs true) * Otherwise returns false */ contains(searchFct); /** * Returns any element from structure (implementor's choice as to which element) * Throws RuntimeException if list is empty */ any(); /** * Adds element into structure * Element is added is to unspecified position -- may be anywhere -- implementor's choice */ add(newElem); /** * Removes first matching element (where searchFct outputs true) * Returns the removed element * If no match, return null */ remove(searchFct); }