kotlin.collections.first

first

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

Returns first element.

Exceptions

NoSuchElementException - if the collection is empty.

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

Returns first element.

Exceptions

NoSuchElementException - if the list is empty.

inline fun <T> Iterable<T>.first(
    predicate: (T) -> Boolean
): T
inlin