com.google.common.collect
Class ForwardingIterator<T>
java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingIterator<T>
- All Implemented Interfaces:
- Serializable, Iterator<T>
- Direct Known Subclasses:
- ForwardingListIterator
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 change or add behavior of
the backing iterator as desired per the decorator pattern.
- Author:
- Kevin Bourrillion
- See Also:
ForwardingObject,
Serialized Form
ForwardingIterator
protected ForwardingIterator(Iterator<T> delegate)
delegate
protected Iterator<T> delegate()
- Description copied from class:
ForwardingObject
- Returns the backing delegate object. This method should be overridden to
specify the correct return type. For example:
@SuppressWarnings("unchecked")
@Override protected Foo delegate() {
return (Foo) super.delegate();
}
This method should always return the same delegate instance that was passed
to the constructor.
- Overrides:
delegate in class ForwardingObject
hasNext
public boolean hasNext()
- Specified by:
hasNext in interface Iterator<T>
next
public T next()
- Specified by:
next in interface Iterator<T>
remove
public void remove()
- Specified by:
remove in interface Iterator<T>