reduceRightIndexed

inline fun ByteBuffer.reduceRightIndexed(operation: (index: Int, Byte, acc: Byte) -> Byte): Byte
inline fun ShortBuffer.reduceRightIndexed(operation: (index: Int, Short, acc: Short) -> Short): Short
inline fun IntBuffer.reduceRightIndexed(operation: (index: Int, Int, acc: Int) -> Int): Int
inline fun LongBuffer.reduceRightIndexed(operation: (index: Int, Long, acc: Long) -> Long): Long
inline fun FloatBuffer.reduceRightIndexed(operation: (index: Int, Float, acc: Float) -> Float): Float
inline fun DoubleBuffer.reduceRightIndexed(operation: (index: Int, Double, acc: Double) -> Double): Double
inline fun CharBuffer.reduceRightIndexed(operation: (index: Int, Char, acc: Char) -> Char): Char

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

Throws an exception if this array is empty. If the array can be empty in an expected way, please use reduceRightIndexedOrNull instead. It returns null when its receiver is empty.

Samples

kool.buffers.Collections.Aggregates.reduceRight

Parameters

operation

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