applyEach

inline fun <T, E> T.applyEach(elements: Iterable<E>, block: T.(e: E) -> Unit): T(source)

Applies the given block to each element in the iterable and returns the receiver object.

Return

The receiver object after applying the block to each element.

Parameters

elements

The iterable collection of elements to apply the block to.

block

The block of code to apply to each element.


inline fun <T> T.applyEach(blocks: Iterable<T.() -> Unit>): T(source)
inline fun <T> T.applyEach(vararg blocks: T.() -> Unit): T(source)

Applies the given blocks to the receiver object.

shorthand for for (block in blocks) apply(block)

Return

The receiver object after applying the block to each element.

Parameters

blocks

The blocks of code to apply to each element.