reduceRight

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

Accumulates value starting with the last element and applying operation from right to left to each element and current accumulator value.

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

Samples

kool.buffers.Collections.Aggregates.reduceRight

Parameters

operation

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