Iterator

interface Iterator<out T>(source)

Visits elements of an Iterable one at a time.

Exhaustion and modification checks are defined by the implementation. ArrayList iterators use IllegalArgumentException for an invalid next call; hash iterators use NoSuchElementException for exhaustion and IllegalStateException for invalidation.

Type Parameters

T

element type.

Inheritors

Functions

Link copied to clipboard
abstract operator fun hasNext(): Boolean

Checks whether another element is available without advancing the iterator.

Link copied to clipboard
abstract operator fun next(): T

Returns the next element and advances the iterator.