All Packages Class Hierarchy This Package Previous Next Index
Interface com.roguewave.tools.v2-0.Collection
- public interface Collection
The Collection interface is implemented by the
collection classes in the com.roguewave.tools.v2-0 package.
The interface contains methods for the insertion, retrieval, and
removal of elements.
-
apply(UnaryFunction)
- Applies the unary function to every element of the collection
in turn.
-
clear()
- Removes all elements from the collection
-
contains(Object)
- Returns true if the collection contains an element equivalent
to the given item.
-
elements()
- Returns an Enumeration object, which can be used to visit
Each element of the collection in turn.
-
find(Object)
- Returns an element from the collection equivalent to the given
item, or null if no such element is found.
-
insert(Object)
- Inserts an item into the collection.
-
insertMany(Enumeration)
- Inserts the elements enumerated by the Enumeration
into the collection.
-
isEmpty()
- Returns true if the collection is empty
-
occurrencesOf(Object)
- Returns the number of elements in the collection equivalent
to a given item.
-
reduce(BinaryFunction, Object)
- Reduces the collection to a single value.
-
remove(Object)
- Removes from the collection the first element
that is equivalent to the given item.
-
removeAll(Object)
- Removes from the collection all elements that are
equivalent to the given item.
-
removeMany(Enumeration)
- Removes from the collection the first elements equivalent to
each item enumerated by the given Enumeration.
-
size()
- Returns the number of entries in the collection
apply
public abstract void apply(UnaryFunction f)
- Applies the unary function to every element of the collection
in turn. Note that the return value of the function is
ignored.
clear
public abstract void clear()
- Removes all elements from the collection
contains
public abstract boolean contains(Object item)
- Returns true if the collection contains an element equivalent
to the given item.
elements
public abstract Enumeration elements()
- Returns an Enumeration object, which can be used to visit
Each element of the collection in turn.
find
public abstract Object find(Object item)
- Returns an element from the collection equivalent to the given
item, or null if no such element is found.
insert
public abstract Object insert(Object item)
- Inserts an item into the collection.
- Returns:
- If the insertion is successful, the method returns
the new element just inserted.
If the insertion fails because a like element already exists
in a collection that does not admit duplicates, the existing
element will be returned.
If the insertion fails for some other reason, null will be
returned.
insertMany
public abstract int insertMany(Enumeration e)
- Inserts the elements enumerated by the Enumeration
into the collection.
- Returns:
- The number of elements inserted into the collection.
isEmpty
public abstract boolean isEmpty()
- Returns true if the collection is empty
occurrencesOf
public abstract int occurrencesOf(Object item)
- Returns the number of elements in the collection equivalent
to a given item.
reduce
public abstract Object reduce(BinaryFunction f,
Object identity)
- Reduces the collection to a single value. A result
is initialized with identity. Then, for each element
in the collection, a new result is computed by calling
the binary function on the current result and the next element.
- Returns:
- The result as described above, or identity
if the collection is empty.
remove
public abstract Object remove(Object item)
- Removes from the collection the first element
that is equivalent to the given item.
removeMany
public abstract int removeMany(Enumeration e)
- Removes from the collection the first elements equivalent to
each item enumerated by the given Enumeration.
- Returns:
- The number of items removed.
removeAll
public abstract int removeAll(Object item)
- Removes from the collection all elements that are
equivalent to the given item.
size
public abstract int size()
- Returns the number of entries in the collection
All Packages Class Hierarchy This Package Previous Next Index