onEachIndexed

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

Performs the given action on each element, providing sequential index with the element, and returns the array itself afterwards.

Parameters

action

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