W3cubDocs

/Kotlin

foldRightIndexed

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
inline fun <T, R> Array<out T>.foldRightIndexed(
    initial: R, 
    operation: (index: Int, T, acc: R) -> R
): R
inline fun <R> ByteArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Byte, acc: R) -> R
): R
inline fun <R> ShortArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Short, acc: R) -> R
): R
inline fun <R> IntArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Int, acc: R) -> R
): R
inline fun <R> LongArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Long, acc: R) -> R
): R
inline fun <R> FloatArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Float, acc: R) -> R
): R
inline fun <R> DoubleArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Double, acc: R) -> R
): R
inline fun <R> BooleanArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Boolean, acc: R) -> R
): R
inline fun <R> CharArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, Char, acc: R) -> R
): R
@ExperimentalUnsignedTypes inline fun <R> UIntArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, UInt, acc: R) -> R
): R
@ExperimentalUnsignedTypes inline fun <R> ULongArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, ULong, acc: R) -> R
): R
@ExperimentalUnsignedTypes inline fun <R> UByteArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, UByte, acc: R) -> R
): R
@ExperimentalUnsignedTypes inline fun <R> UShortArray.foldRightIndexed(
    initial: R, 
    operation: (index: Int, UShort, acc: R) -> R
): R

Accumulates value starting with initial value and applying operation from right to left to each element with its index in the original array and current accumulator value.

Parameters

operation - function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
inline fun <T, R> List<T>.foldRightIndexed(
    initial: R, 
    operation: (index: Int, T, acc: R) -> R
): R

Accumulates value starting with initial value and applying operation from right to left to each element with its index in the original list and current accumulator value.

Parameters

operation - function that takes the index of an element, the element itself and current accumulator value, and calculates the next accumulator value.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/fold-right-indexed.html