forEachIndexed

Common
JVM
JS
Native
1.0
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)
@ExperimentalUnsignedTypes inline fun UIntArray.forEachIndexed(
    action: (index: Int, UInt) -> Unit)

(source)
@ExperimentalUnsignedTypes inline fun ULongArray.forEachIndexed(
    action: (index: Int, ULong) -> Unit)

(source)
@ExperimentalUnsignedTypes inline fun UByteArray.forEachIndexed(
    action: (index: Int, UByte) -> Unit)

(source)
@ExperimentalUnsignedTypes inline fun UShortArray.forEachIndexed(
    action: (index: Int, UShort) -> Unit)

(source)

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

Parameters

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