firstOrNull

fun ByteBuffer.firstOrNull(): Byte?
fun ShortBuffer.firstOrNull(): Short?
fun IntBuffer.firstOrNull(): Int?
fun LongBuffer.firstOrNull(): Long?
fun FloatBuffer.firstOrNull(): Float?
fun DoubleBuffer.firstOrNull(): Double?
fun CharBuffer.firstOrNull(): Char?

Returns the first element, or null if the buffer is empty.

inline fun ByteBuffer.firstOrNull(predicate: (Byte) -> Boolean): Byte?
inline fun ShortBuffer.firstOrNull(predicate: (Short) -> Boolean): Short?
inline fun IntBuffer.firstOrNull(predicate: (Int) -> Boolean): Int?
inline fun LongBuffer.firstOrNull(predicate: (Long) -> Boolean): Long?
inline fun FloatBuffer.firstOrNull(predicate: (Float) -> Boolean): Float?
inline fun DoubleBuffer.firstOrNull(predicate: (Double) -> Boolean): Double?
inline fun CharBuffer.firstOrNull(predicate: (Char) -> Boolean): Char?

Returns the first element matching the given predicate, or null if element was not found.