Class TransformingIteratorWrapper<Original, Transformed>
java.lang.Object
org.archive.util.iterator.LookaheadIterator<Transformed>
org.archive.util.iterator.TransformingIteratorWrapper<Original, Transformed>
- All Implemented Interfaces:
Iterator<Transformed>
- Direct Known Subclasses:
RegexLineIterator
public abstract class TransformingIteratorWrapper<Original, Transformed>
extends LookaheadIterator<Transformed>
Superclass for Iterators which transform and/or filter results
from a wrapped Iterator. Because transform() has the option of
discarding an item from the inner Iterator (by returning null),
this is a kind of LookaheadIterator.
- Author:
- gojomo
-
Field Summary
FieldsFields inherited from class org.archive.util.iterator.LookaheadIterator
next -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCaches the next item if available.protected voidAny cleanup to occur when hasNext() is about to return falseprotected abstract TransformedMethods inherited from class org.archive.util.iterator.LookaheadIterator
hasNext, next, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
inner
-
-
Constructor Details
-
TransformingIteratorWrapper
public TransformingIteratorWrapper()
-
-
Method Details
-
lookahead
protected boolean lookahead()Description copied from class:LookaheadIteratorCaches the next item if available.- Specified by:
lookaheadin classLookaheadIterator<Transformed>- Returns:
- true if there was a next item to cache, false otherwise
-
noteExhausted
protected void noteExhausted()Any cleanup to occur when hasNext() is about to return false -
transform
- Parameters:
object- Object to transform.- Returns:
- Transfomed object.
-