first

inline fun first(): E

Returns the first element in the collection.

Throws

if the collection is empty


inline fun first(predicate: (element: E) -> Boolean): E

Returns the first element in the collection for which predicate returns true

Return

The element for which predicate returns true.

Parameters

predicate

called with each element until it returns true.

Throws

if predicate returns false for all elements or the collection is empty.