first (original) (raw)
fun <T> Array<out T>.first(): T(source)
fun ByteArray.first(): Byte(source)
fun ShortArray.first(): Short(source)
fun IntArray.first(): Int(source)
fun LongArray.first(): Long(source)
fun FloatArray.first(): Float(source)
fun DoubleArray.first(): Double(source)
fun BooleanArray.first(): Boolean(source)
fun CharArray.first(): Char(source)
Returns the first element.
Since Kotlin
1.0
Throws
if the array is empty.
inline fun <T> Array<out T>.first(predicate: (T) -> Boolean): T(source)
inline fun ByteArray.first(predicate: (Byte) -> Boolean): Byte(source)
inline fun ShortArray.first(predicate: (Short) -> Boolean): Short(source)
inline fun IntArray.first(predicate: (Int) -> Boolean): Int(source)
inline fun LongArray.first(predicate: (Long) -> Boolean): Long(source)
inline fun FloatArray.first(predicate: (Float) -> Boolean): Float(source)
inline fun DoubleArray.first(predicate: (Double) -> Boolean): Double(source)
inline fun BooleanArray.first(predicate: (Boolean) -> Boolean): Boolean(source)
inline fun CharArray.first(predicate: (Char) -> Boolean): Char(source)
inline fun <T> Iterable<T>.first(predicate: (T) -> Boolean): T(source)
Returns the first element matching the given predicate.
Since Kotlin
1.0
Throws
if no such element is found.
fun <T> Iterable<T>.first(): T(source)
Returns the first element.
Since Kotlin
1.0
Throws
if the collection is empty.
fun <T> List<T>.first(): T(source)
Returns the first element.
Since Kotlin
1.0
Throws
if the list is empty.
inline fun UIntArray.first(): UInt(source)
inline fun ULongArray.first(): ULong(source)
inline fun UByteArray.first(): UByte(source)
inline fun UShortArray.first(): UShort(source)
Returns the first element.
Since Kotlin
1.3
Throws
if the array is empty.
inline fun UIntArray.first(predicate: (UInt) -> Boolean): UInt(source)
inline fun ULongArray.first(predicate: (ULong) -> Boolean): ULong(source)
inline fun UByteArray.first(predicate: (UByte) -> Boolean): UByte(source)
inline fun UShortArray.first(predicate: (UShort) -> Boolean): UShort(source)
Returns the first element matching the given predicate.
Since Kotlin
1.3
Throws
if no such element is found.