@GwtCompatible public abstract class ForwardingIterator<T> extends ForwardingObject implements Iterator<T>
An iterator which forwards all its method calls to another iterator. Subclasses should override one or more methods to modify the behavior of the backing iterator as desired per the decorator pattern.
Modifier | Constructor and Description |
---|---|
protected |
ForwardingIterator()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Iterator<T> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
boolean |
hasNext() |
T |
next() |
void |
remove() |
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEachRemaining
protected ForwardingIterator()
Constructor for use by subclasses.
protected abstract Iterator<T> delegate()
ForwardingObject
Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such as ForwardingSet.delegate()
. Concrete subclasses override this method to supply the instance being decorated.
delegate
in class ForwardingObject