|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xshare.base.iterator.FilterIterator
Filters the elements of another iteration based on a
UnaryPredicate
wrapping
an given iterator and applying a
UnaryPredicate
for
each element. Only elements, there the predicate is
true
are returned by this iterator.
true
- in the same order as they
are found in the source iterator.
RangeIterator
Constructor Summary | |
FilterIterator(UnaryPredicate pFilterPredicate,
java.util.Iterator pSourceIterator)
Creates a new instance of this iterator for a given predicate and iterator. |
Method Summary | |
boolean |
hasNext()
Checks if there are some elements left, for which the condition given to the constructor is true . |
java.lang.Object |
next()
Returns the next element which fits in the condition
set with the constructor of this instance. |
void |
remove()
This method is not supported since this class is only an adapter for another iterator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FilterIterator(UnaryPredicate pFilterPredicate, java.util.Iterator pSourceIterator)
pFilterPredicate
- an UnaryPredicate
which is evaluated for every element of the underlying iterator.pSourceIterator
- an arbitrary iterator which should be filtered
according to the criterias expressed in the given predicate.Method Detail |
public void remove()
remove
in interface java.util.Iterator
java.lang.UnsupportedOperationException
- if this method is called.public java.lang.Object next()
condition
set with the constructor of this instance.
next
in interface java.util.Iterator
java.util.NoSuchElementException
- if hasNext()
denies the
that there are objects left.hasNext()
public boolean hasNext()
true
.
hasNext
in interface java.util.Iterator
boolean
value, which is true
if there are some elements left to return via next()
.
Otherwise false
is returned.next()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |