Class ConstantAppendingLongIterator
java.lang.Object
com.complexible.common.primitives.AbstractLongIterator
com.complexible.common.primitives.ConstantAppendingLongIterator
- All Implemented Interfaces:
PeekingLongIterator,CloseableLongIterator,LongIterator,ResettableLongIterator,AutoCloseable
This is a union of a long iterator with a constant. The constant is returned at the end only if the base iterator does not return it.
This is useful, in particular, for implementing path iterations of length zero or more.
- Version:
- 5.1
- Author:
- Pavel Klinov
-
Field Summary
Fields inherited from class com.complexible.common.primitives.AbstractLongIterator
mNextFields inherited from interface com.complexible.common.primitives.LongIterator
NO_NEXT_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionConstantAppendingLongIterator(CloseableLongIterator theIterator, long theConstant) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected longComputes the next long to be returned by the iterator.protected voidResets the state so iteration can start over.
-
Constructor Details
-
ConstantAppendingLongIterator
-
-
Method Details
-
computeNext
protected long computeNext()Computes the next long to be returned by the iterator. The only method supposed to be implemented by subclasses.- Specified by:
computeNextin classAbstractLongIterator
-
close
public void close() -
performReset
protected void performReset()Description copied from class:AbstractLongIteratorResets the state so iteration can start over.- Specified by:
performResetin classAbstractLongIterator
-