|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.util.Iterators.Modifier<E>
public abstract static class Iterators.Modifier<E>
An Iterator.Modifier uses a single abstract method
to operate on the elements returned by an underlying iterator
to return modified objects. The remove() and hasNext() methods are simply passed to the underlying iterator.
This implements the filter pattern, which is known as a map in
functional programming.
| Constructor Summary | |
|---|---|
Iterators.Modifier(Iterator<? extends E> it)
Construct a modifier from an underlying iterator. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Returns true if the underlying iterator has
more elements. |
abstract E |
modify(E next)
This abstract method is applied to objects returned by the underlying iterator to create the object returned by this iterator. |
E |
next()
Returns the next element for this iterator, which is the object returned by the underlying iterator after undergoing modification by modify(Object). |
void |
remove()
Remove the next element by delegating the call to the the underlying iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Iterators.Modifier(Iterator<? extends E> it)
it - Underlying iterator.| Method Detail |
|---|
public void remove()
remove in interface Iterator<E>public boolean hasNext()
true if the underlying iterator has
more elements. This method is simply delegated to the
underlying iterator.
hasNext in interface Iterator<E>true if this iterator has more
elements.public E next()
modify(Object).
next in interface Iterator<E>public abstract E modify(E next)
next().
next - Object returned by underlying iterator.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||