first

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 first element.

Exceptions

NoSuchElementException - 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.

Exceptions

NoSuchElementException - if no such element is found.

fun <T> Iterable<T>.first(): T (source)

Returns first element.

Exceptions

NoSuchElementException - if the collection is empty.

fun <T> List<T>.first(): T (source)

Returns first element.

Exceptions

NoSuchElementException - if the list is empty.