firstOrNull

Common
JVM
JS
Native
1.0
fun <T> Array<out T>.firstOrNull(): T?
(source)
fun ByteArray.firstOrNull(): Byte?
(source)
fun ShortArray.firstOrNull(): Short?
(source)
fun IntArray.firstOrNull(): Int?
(source)
fun LongArray.firstOrNull(): Long?
(source)
fun FloatArray.firstOrNull(): Float?
(source)
fun DoubleArray.firstOrNull(): Double?
(source)
fun BooleanArray.firstOrNull(): Boolean?
(source)
fun CharArray.firstOrNull(): Char?
(source)
@ExperimentalUnsignedTypes fun UIntArray.firstOrNull(): UInt?
(source)
@ExperimentalUnsignedTypes fun ULongArray.firstOrNull(): ULong?
(source)
@ExperimentalUnsignedTypes fun UByteArray.firstOrNull(): UByte?
(source)
@ExperimentalUnsignedTypes fun UShortArray.firstOrNull(): UShort?
(source)

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

Common
JVM
JS
Native
1.0
inline fun <T> Array<out T>.firstOrNull(
    predicate: (T) -> Boolean
): T?

(source)
inline fun ByteArray.firstOrNull(
    predicate: (Byte) -> Boolean
): Byte?

(source)
inline fun ShortArray.firstOrNull(
    predicate: (Short) -> Boolean
): Short?

(source)
inline fun IntArray.firstOrNull(
    predicate: (Int) -> Boolean
): Int?

(source)
inline fun LongArray.firstOrNull(
    predicate: (Long) -> Boolean
): Long?

(source)
inline fun FloatArray.firstOrNull(
    predicate: (Float) -> Boolean
): Float?

(source)
inline fun DoubleArray.firstOrNull(
    predicate: (Double) -> Boolean
): Double?

(source)
inline fun BooleanArray.firstOrNull(
    predicate: (Boolean) -> Boolean
): Boolean?

(source)
inline fun CharArray.firstOrNull(
    predicate: (Char) -> Boolean
): Char?

(source)
inline fun <T> Iterable<T>.firstOrNull(
    predicate: (T) -> Boolean
): T?

(source)
@ExperimentalUnsignedTypes inline fun UIntArray.firstOrNull(
    predicate: (UInt) -> Boolean
): UInt?

(source)
@ExperimentalUnsignedTypes inline fun ULongArray.firstOrNull(
    predicate: (ULong) -> Boolean
): ULong?

(source)
@ExperimentalUnsignedTypes inline fun UByteArray.firstOrNull(
    predicate: (UByte) -> Boolean
): UByte?

(source)
@ExperimentalUnsignedTypes inline fun UShortArray.firstOrNull(
    predicate: (UShort) -> Boolean
): UShort?

(source)

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

Common
JVM
JS
Native
1.0
fun <T> Iterable<T>.firstOrNull(): T?
(source)

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

Common
JVM
JS
Native
1.0
fun <T> List<T>.firstOrNull(): T?
(source)

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