fun <T> Array<out T>.first(): T
fun ByteArray.first(): Byte
fun ShortArray.first(): Short
fun IntArray.first(): Int
fun LongArray.first(): Long
fun FloatArray.first(): Float
fun DoubleArray.first(): Double
fun BooleanArray.first(): Boolean
fun CharArray.first(): Char
@ExperimentalUnsignedTypes fun UIntArray.first(): UInt
@ExperimentalUnsignedTypes fun ULongArray.first(): ULong
@ExperimentalUnsignedTypes fun UByteArray.first(): UByte
@ExperimentalUnsignedTypes fun UShortArray.first(): UShort
Returns first element.
NoSuchElementException
- if the array is empty.
inline fun <T> Array<out T>.first( predicate: (T) -> Boolean ): T
inline fun ByteArray.first( predicate: (Byte) -> Boolean ): Byte
inline fun ShortArray.first( predicate: (Short) -> Boolean ): Short
inline fun IntArray.first(predicate: (Int) -> Boolean): Int
inline fun LongArray.first( predicate: (Long) -> Boolean ): Long
inline fun FloatArray.first( predicate: (Float) -> Boolean ): Float
inline fun DoubleArray.first( predicate: (Double) -> Boolean ): Double
inline fun BooleanArray.first( predicate: (Boolean) -> Boolean ): Boolean
inline fun CharArray.first( predicate: (Char) -> Boolean ): Char
inline fun <T> Iterable<T>.first( predicate: (T) -> Boolean ): T
@ExperimentalUnsignedTypes inline fun UIntArray.first( predicate: (UInt) -> Boolean ): UInt
@ExperimentalUnsignedTypes inline fun ULongArray.first( predicate: (ULong) -> Boolean ): ULong
@ExperimentalUnsignedTypes inline fun UByteArray.first( predicate: (UByte) -> Boolean ): UByte
@ExperimentalUnsignedTypes inline fun UShortArray.first( predicate: (UShort) -> Boolean ): UShort
Returns the first element matching the given predicate.
NoSuchElementException
- if no such element is found.
fun <T> Iterable<T>.first(): T
Returns first element.
NoSuchElementException
- if the collection is empty.
fun <T> List<T>.first(): T
Returns first element.
NoSuchElementException
- if the list is empty.
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/first.html