Package org.jinq.orm.stream
Class NextOnlyIterator<T>
- java.lang.Object
-
- org.jinq.orm.stream.NextOnlyIterator<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
java.util.Iterator<T>
public abstract class NextOnlyIterator<T> extends java.lang.Object implements java.util.Iterator<T>
Creating things that act like iterators is annoying because the programmer has to supply implementations of the hasNext() and next() methods. This class is similar to the GUAVA AbstractIterator.
-
-
Constructor Summary
Constructors Constructor Description NextOnlyIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
generateNext()
This method will be called by the iterator whenever it needs to find the next element to be iterated over.boolean
hasNext()
T
next()
protected void
nextElement(T el)
Call this from generateNext() with the next element to be returned from the iterator.protected void
noMoreElements()
Call this from generateNext() if there are no more elements to be iterated over.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
generateNext
protected abstract void generateNext()
This method will be called by the iterator whenever it needs to find the next element to be iterated over. Each time generateNext() is called, it should call nextElement() or noMoreElements() as appropriate.
-
nextElement
protected void nextElement(T el)
Call this from generateNext() with the next element to be returned from the iterator.- Parameters:
el
-
-
noMoreElements
protected void noMoreElements()
Call this from generateNext() if there are no more elements to be iterated over.
-
-