# 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

Returns `true`

if the iteration has more elements.

`open fun hasNext(): Boolean`

#### next

Returns the next element in the iteration.

`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 wrapping each value produced by this Iterator with the IndexedValue, containing value and it's index.

`fun <T> Iterator<T>.withIndex(): Iterator<IndexedValue<T>>`