AbstractIterator
abstract class AbstractIterator<T> : Iterator<T>
A base class to simplify implementing iterators so that implementations only have to implement computeNext to implement the iterator, calling done when the iteration is complete.
Constructors
<init>
A base class to simplify implementing iterators so that implementations only have to implement computeNext to implement the iterator, calling done when the iteration is complete.
AbstractIterator()
Functions
computeNext
Computes the next item in the iterator.
abstract fun computeNext()
done
Sets the state to done so that the iteration terminates.
fun done()
hasNext
open fun hasNext(): Boolean
next
open fun next(): T
setNext
Sets the next value in the iteration, called from the computeNext function
fun setNext(value: T)
Extension Functions
withIndex
Returns an Iterator that wraps each element produced by the original iterator into an IndexedValue containing the index of that element and the element itself.
fun <T> Iterator<T>.withIndex(): Iterator<IndexedValue<T>>