StringPredicateEnumeration filters an
Enumeration with a StringPredicateInterface.
Only those strings which satisfy the predicate are returned by
the enumeration.
StringPredicateEnumeration is a Decorator class.
It takes in its constructor a primary Enumeration and a StringPredicateInterface.
The PredicateEnumeration then acts as an Enumeration. It retrieves values
from the primary Enumeration, but only returns items such that the specified
boolean predicate returns true. Thus, the PredicateEnumeration acts as
a way to filter another enumeration of String values with a boolean test
that operates on String values.
Construct a PredicateEnumeration which filters another enumeration
by guarding it's values with a predicate. That is, this filter
only returns items via enumer.nextElement() if the predicate is true
for those items. hasMoreElements() works by performing a
look-ahead and running the predicate (one time) on subsequent items
until one is found which satisfies the predicate (it will be returned
by the next call to nextElement(), or no more items exist.
Parameters:
enumer - the primary enumeration filtered by this PredicateEnumeration
predicate - the predicate used to filter the primary enumertion.
Only items which satisfy this boolean predicate are returned
by nextElement()