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 ofLongIterator
allowing subclasses to concentrate of computing next elements.- Version:
- 5.1
- Author:
- Pavel Klinov
-
-
Field Summary
Fields Modifier and Type Field Description protected long
mNext
-
Fields inherited from interface com.complexible.common.primitives.LongIterator
NO_NEXT_ELEMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLongIterator()
protected
AbstractLongIterator(long theFirst)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract long
computeNext()
Computes the next long to be returned by the iterator.protected long
endOfData()
boolean
hasNext()
long
next()
long
peek()
protected abstract void
performReset()
Resets the state so iteration can start over.void
reset()
-
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:
reset
in interfaceResettableLongIterator
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceLongIterator
-
next
public final long next()
- Specified by:
next
in interfaceLongIterator
-
peek
public final long peek()
- Specified by:
peek
in 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.
-
-