dave08
02/04/2019, 11:39 AMfind { }
and firstOrNull { }
on Iterable<T>
in the stdlib?gsala
02/04/2019, 11:46 AMAnton Lakotka [JB]
02/04/2019, 11:46 AM/**
* Returns the first element matching the given [predicate], or `null` if no such element was found.
*/
@kotlin.internal.InlineOnly
public inline fun <T> Iterable<T>.find(predicate: (T) -> Boolean): T? {
return firstOrNull(predicate)
}
dave08
02/04/2019, 11:49 AMfind
?Anton Lakotka [JB]
02/04/2019, 11:53 AMdave08
02/04/2019, 12:14 PMSet<T>.find
... I was surprised it was on Iterable
. Thanks for the confirmation 🙂!