public class IteratorDecorator<T> extends Object implements Iterator<T>, Serializable
Iterator
that is designed to
facilitate subclasses that need to extend the functionality of an existing
iterator. For example, a subclass of this may need to perform additional
clean-up after a remove()
operation, or may need to ensure that the
current element meets some additional criteria by altering the behavior of
hasNext()
.
In its default behavior, this class performs identically to the backing iterator, passing all method calls through and return the respective values.
Modifier and Type | Field and Description |
---|---|
protected T |
cur
The element that was just returned or
null if no elements have
been returned yet or if the current element was removed via remove() . |
Constructor and Description |
---|
IteratorDecorator(Iterator<T> iter)
Creates a new decorator around the existing iterator.
|
Copyright © 2012. All Rights Reserved.