kotlin / 1.7.0 / api / latest / jvm / stdlib / kotlin.collections / min-by.html /

minBy

Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <T, R : Comparable<R>> Array<out T>.minBy(
    selector: (T) -> R
): T
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <T, R : Comparable<R>> Array<out T>.minBy(
    selector: (T) -> R
): T?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> ByteArray.minBy(
    selector: (Byte) -> R
): Byte
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> ByteArray.minBy(
    selector: (Byte) -> R
): Byte?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> ShortArray.minBy(
    selector: (Short) -> R
): Short
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> ShortArray.minBy(
    selector: (Short) -> R
): Short?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> IntArray.minBy(
    selector: (Int) -> R
): Int
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> IntArray.minBy(
    selector: (Int) -> R
): Int?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> LongArray.minBy(
    selector: (Long) -> R
): Long
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> LongArray.minBy(
    selector: (Long) -> R
): Long?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> FloatArray.minBy(
    selector: (Float) -> R
): Float
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> FloatArray.minBy(
    selector: (Float) -> R
): Float?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> DoubleArray.minBy(
    selector: (Double) -> R
): Double
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> DoubleArray.minBy(
    selector: (Double) -> R
): Double?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> BooleanArray.minBy(
    selector: (Boolean) -> R
): Boolean
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> BooleanArray.minBy(
    selector: (Boolean) -> R
): Boolean?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <R : Comparable<R>> CharArray.minBy(
    selector: (Char) -> R
): Char
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <R : Comparable<R>> CharArray.minBy(
    selector: (Char) -> R
): Char?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow-U") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UIntArray.minBy(
    selector: (UInt) -> R
): UInt
Platform and version requirements: JVM (1.3)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UIntArray.minBy(
    selector: (UInt) -> R
): UInt?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow-U") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> ULongArray.minBy(
    selector: (ULong) -> R
): ULong
Platform and version requirements: JVM (1.3)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> ULongArray.minBy(
    selector: (ULong) -> R
): ULong?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow-U") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UByteArray.minBy(
    selector: (UByte) -> R
): UByte
Platform and version requirements: JVM (1.3)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UByteArray.minBy(
    selector: (UByte) -> R
): UByte?
Deprecated: Use minByOrNull instead.
Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow-U") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UShortArray.minBy(
    selector: (UShort) -> R
): UShort
Platform and version requirements: JVM (1.3)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes inline fun <R : Comparable<R>> UShortArray.minBy(
    selector: (UShort) -> R
): UShort?
Deprecated: Use minByOrNull instead.

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



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

Exceptions

NoSuchElementException - if the array is empty.

Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <T, R : Comparable<R>> Iterable<T>.minBy(
    selector: (T) -> R
): T
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <T, R : Comparable<R>> Iterable<T>.minBy(
    selector: (T) -> R
): T?
Deprecated: Use minByOrNull instead.

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



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

Exceptions

NoSuchElementException - if the collection is empty.

Platform and version requirements: JS (1.7), Native (1.7)
@JvmName("minByOrThrow") inline fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>
Platform and version requirements: JVM (1.0)
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") inline fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?
Deprecated: Use minByOrNull instead.

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



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

Exceptions

NoSuchElementException - if the map is empty.

© 2010–2022 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/min-by.html