jds
Interface Bag
- All Known Subinterfaces:
- Set
- All Known Implementing Classes:
- AVLTree, BinarySearchTree, Hashtable, LinkedList, OpenHashtable, SkipList, SortedVector
- public abstract interface Bag
- extends 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.
- See Also:
Collection
Fields inherited from class java.io.Serializable |
serialVersionUID |
Method Summary |
void |
addElement(java.lang.Object value)
add a new value to the collection |
boolean |
containsElement(java.lang.Object value)
see if collection contains value |
java.lang.Object |
findElement(java.lang.Object value)
find element that will test equal to value |
void |
removeElement(java.lang.Object value)
remove a new value from the collection |
addElement
public void addElement(java.lang.Object value)
- add a new value to the collection
- Parameters:
value
- element to be inserted into collection
containsElement
public boolean containsElement(java.lang.Object value)
- see if collection contains value
- Parameters:
value
- element to be tested- Returns:
- true if collection contains value
findElement
public java.lang.Object findElement(java.lang.Object value)
- find element that will test equal to value
- Parameters:
value
- element to be tested- Returns:
- first value that is
equals
to argument - Throws:
- java.util.NoSuchElementException - no matching value
removeElement
public void removeElement(java.lang.Object value)
- remove a new value from the collection
- Parameters:
value
- element to be removed from collection- Throws:
- java.util.NoSuchElementException - no matching value