sdk-common / com.tomtom.online.sdk.common.functional.collections / Iterables / forEach

forEach

static fun <A : Any!> forEach(@NonNull iterable: MutableIterable<A>, @NonNull consumer: Consumer1<A>): Unit

Performs the given action for each element of provided Iterable.

static fun <A : Any!> forEach(@NonNull array: Array<A>, @NonNull consumer: Consumer1<A>): Unit

Performs the given action for each element of provided array.

static fun <A : Any!> forEach(@NonNull iterable: MutableIterable<A>, @NonNull predicate: Predicate<A>, @NonNull consumer: Consumer1<A>): Unit

Performs the given action for each element of the provided Iterable that satisfies the given Predicate.

Parameters

iterable - MutableIterable<A>: iterable of values that should have an action performed

predicate - Predicate<A>: predicate that needs to be satisfied

consumer - Consumer1<A>: action that should be performed if the predicate is satisfied

- value type