Class ConstantAppendingLongIterator
- java.lang.Object
-
- com.complexible.common.primitives.AbstractLongIterator
-
- com.complexible.common.primitives.ConstantAppendingLongIterator
-
- All Implemented Interfaces:
PeekingLongIterator,CloseableLongIterator,LongIterator,ResettableLongIterator,java.lang.AutoCloseable
public class ConstantAppendingLongIterator extends AbstractLongIterator
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
mNext
-
Fields inherited from interface com.complexible.common.primitives.LongIterator
NO_NEXT_ELEMENT
-
-
Constructor Summary
Constructors Constructor Description ConstantAppendingLongIterator(CloseableLongIterator theIterator, long theConstant)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected longcomputeNext()Computes the next long to be returned by the iterator.protected voidperformReset()Resets the state so iteration can start over.
-
-
-
Constructor Detail
-
ConstantAppendingLongIterator
public ConstantAppendingLongIterator(CloseableLongIterator theIterator, long theConstant)
-
-
Method Detail
-
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
-
-