W3cubDocs

/Kotlin

maxBy

inline fun <T, R : Comparable<R>> Iterable<T>.maxBy(
    selector: (T) -> R
): T?
inline fun <T, R : Comparable<R>> Array<out T>.maxBy(
    selector: (T) -> R
): T?
inline fun <R : Comparable<R>> ByteArray.maxBy(
    selector: (Byte) -> R
): Byte?
inline fun <R : Comparable<R>> ShortArray.maxBy(
    selector: (Short) -> R
): Short?
inline fun <R : Comparable<R>> IntArray.maxBy(
    selector: (Int) -> R
): Int?
inline fun <R : Comparable<R>> LongArray.maxBy(
    selector: (Long) -> R
): Long?
inline fun <R : Comparable<R>> FloatArray.maxBy(
    selector: (Float) -> R
): Float?
inline fun <R : Comparable<R>> DoubleArray.maxBy(
    selector: (Double) -> R
): Double?
inline fun <R : Comparable<R>> BooleanArray.maxBy(
    selector: (Boolean) -> R
): Boolean?
inline fun <R : Comparable<R>> CharArray.maxBy(
    selector: (Char) -> R
): Char?

Returns the first element yielding the largest value of the given function or null if there are no elements.

inline fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(
    selector: (Entry<K, V>) -> R
): Entry<K, V>?

Returns the first entry yielding the largest value of the given function or null if there are no entries.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/max-by.html