@GwtCompatible public abstract class ForwardingIterator<T> extends ForwardingObject implements Iterator<T>
default
method warning: This class forwards calls to only some default
methods. Specifically, it forwards calls only for methods that existed before default
methods were introduced. For newer methods, like forEachRemaining
, it inherits their
default implementations. When those implementations invoke methods, they invoke methods on the
ForwardingIterator
.
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()
Returns
true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned
by this iterator (optional operation).
|
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEachRemaining
protected ForwardingIterator()
protected abstract Iterator<T> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply the
instance being decorated.delegate
in class ForwardingObject
public boolean hasNext()
java.util.Iterator
true
if the iteration has more elements.
(In other words, returns true
if Iterator.next()
would
return an element rather than throwing an exception.)@CanIgnoreReturnValue public T next()
java.util.Iterator
public void remove()
java.util.Iterator
Iterator.next()
. The behavior of an iterator
is unspecified if the underlying collection is modified while the
iteration is in progress in any way other than by calling this
method.Copyright © 2010–2017. All rights reserved.