forEachIndexed

inline fun <T> Array<out T>.forEachIndexed(action: (index: Int, T) -> Unit)(source)
inline fun ByteArray.forEachIndexed(action: (index: Int, Byte) -> Unit)(source)
inline fun ShortArray.forEachIndexed(action: (index: Int, Short) -> Unit)(source)
inline fun IntArray.forEachIndexed(action: (index: Int, Int) -> Unit)(source)
inline fun LongArray.forEachIndexed(action: (index: Int, Long) -> Unit)(source)
inline fun FloatArray.forEachIndexed(action: (index: Int, Float) -> Unit)(source)
inline fun DoubleArray.forEachIndexed(action: (index: Int, Double) -> Unit)(source)
inline fun BooleanArray.forEachIndexed(action: (index: Int, Boolean) -> Unit)(source)
inline fun CharArray.forEachIndexed(action: (index: Int, Char) -> Unit)(source)
inline fun <T> Iterable<T>.forEachIndexed(action: (index: Int, T) -> Unit)(source)

Performs the given action on each element, providing sequential index with the element.

Since Kotlin

1.0

Parameters

action

function that takes the index of an element and the element itself and performs the action on the element.


Performs the given action on each element, providing sequential index with the element.

Since Kotlin

1.3

Parameters

action

function that takes the index of an element and the element itself and performs the action on the element.