minBy

@JvmName(name = "minByOrThrow")
inline fun <T, R : Comparable<R>> Sequence<T>.minBy(selector: (T) -> R): T(source)

Returns the first element yielding the smallest value of the given function.

The operation is terminal.

Since Kotlin

1.7

Throws

if the sequence is empty.

Samples

samples.collections.Collections.Aggregates.minBy
inline fun <T, R : Comparable<R>> Sequence<T>.minBy(selector: (T) -> R): T?(source)

Deprecated

Warning since 1.4

Error since 1.5

Hidden since 1.6

Use minByOrNull instead.

Replace with

this.minByOrNull(selector)

Since Kotlin

1.0