minBy

Common
JS
Native
1.7
@JvmName("minByOrThrow") inline fun <T, R : Comparable<R>> Sequence<T>.minBy(
    selector: (T) -> R
): T

(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <T, R : Comparable<R>> Sequence<T>.minBy(
    selector: (T) -> R
): T?

(source)
Deprecated: Use minByOrNull instead.

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

The operation is terminal.



fun main(args: Array<String>) {
//sampleStart
//Unresolved: samples.collections.Collections.Aggregates.minBy
//sampleEnd
}

Exceptions

NoSuchElementException - if the sequence is empty.