forEachRemaining

open fun forEachRemaining(action: (T) -> Unit)

Performs the given action for each remaining element, sequentially, until all elements have been processed or the action throws an exception. If this Spliterator is ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.

Default implementation repeatedly invokes tryAdvance until it returns false.

Parameters

action

The action.

Throws

if the specified action is null (implicit in Kotlin non-null type).