All Packages Class Hierarchy This Package Previous Next Index
Interface structure.Collection
- public interface Collection
- extends Store
An interface for structures that allow you to add, remove, and
check for containment. Many structures in the structure package
are efficiently implemented if you can limit your usage to this
interface.
add(Object)
- Add a value to the structure.
contains(Object)
- Determine if the structure contains a value.
elements()
- Construct an iterator over the elements of the structure.
remove(Object)
- Remove a value from the store.
contains
public abstract boolean contains(Object value)
- Determine if the structure contains a value.
- Precondition:
- value is non-null
- Postcondition:
- returns true iff the collection contains the value
- Parameters:
- value - The value sought.
- Returns:
- True if the structure contains the value.
add
public abstract void add(Object value)
- Add a value to the structure.
- Precondition:
- value is non-null
- Postcondition:
- the value is added to the collection
the replacement policy is not specified.
- Parameters:
- value - The value to be added.
remove
public abstract Object remove(Object value)
- Remove a value from the store.
- Precondition:
- value is non-null
- Postcondition:
- removes an object "equal" to value within collection.
- Parameters:
- value - The value to be removed.
- Returns:
- The value actually removed.
elements
public abstract Iterator elements()
- Construct an iterator over the elements of the structure.
- Postcondition:
- returns an iterator for traversing collection
- Returns:
- An iterator over the structure.
All Packages Class Hierarchy This Package Previous Next Index