peek

abstract fun peek(): E(source)

Returns the next element in iteration without advancing the underlying iterator. If the iterator is already exhausted, null will be returned.

Note: this method does not throw a NoSuchElementException if the iterator is already exhausted. If you want such a behavior, use element instead.

The rationale behind this is to follow the java.util.Queue interface which uses the same terminology.

Return

the next element from the iterator