forEachIndexed

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

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 desired action on the element.