E - the type of objects returned by the iteratorpublic abstract static class Iterators.Modifier<E> extends Object implements Iterator<E>
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 and Description |
|---|
Iterators.Modifier(Iterator<? extends E> it)
Construct a modifier from an underlying iterator.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public void remove()
public boolean hasNext()
true if the underlying iterator has
more elements. This method is simply delegated to the
underlying iterator.public E next()
modify(Object).public abstract E modify(E next)
next().next - Object returned by underlying iterator.Copyright © 2016 Alias-i, Inc.. All rights reserved.