Class AbstractLongIterator
- java.lang.Object
-
- com.complexible.common.primitives.AbstractLongIterator
-
- All Implemented Interfaces:
PeekingLongIterator,CloseableLongIterator,LongIterator,ResettableLongIterator,java.lang.AutoCloseable
- Direct Known Subclasses:
AbstractSkippingLongIterator,ConstantAppendingLongIterator
public abstract class AbstractLongIterator extends java.lang.Object implements ResettableLongIterator, PeekingLongIterator, CloseableLongIterator
A skeleton implementation ofLongIteratorallowing subclasses to concentrate of computing next elements.- Version:
- 5.1
- Author:
- Pavel Klinov
-
-
Field Summary
Fields Modifier and Type Field Description protected longmNext-
Fields inherited from interface com.complexible.common.primitives.LongIterator
NO_NEXT_ELEMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLongIterator()protectedAbstractLongIterator(long theFirst)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract longcomputeNext()Computes the next long to be returned by the iterator.protected longendOfData()booleanhasNext()longnext()longpeek()protected abstract voidperformReset()Resets the state so iteration can start over.voidreset()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.complexible.common.primitives.CloseableLongIterator
close
-
-
-
-
Method Detail
-
reset
public final void reset()
- Specified by:
resetin interfaceResettableLongIterator
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceLongIterator
-
next
public final long next()
- Specified by:
nextin interfaceLongIterator
-
peek
public final long peek()
- Specified by:
peekin interfacePeekingLongIterator
-
endOfData
protected final long endOfData()
-
computeNext
protected abstract long computeNext()
Computes the next long to be returned by the iterator. The only method supposed to be implemented by subclasses.
-
performReset
protected abstract void performReset()
Resets the state so iteration can start over.
-
-