maxBy
Returns the first element yielding the largest value of the given function.
Since Kotlin
1.7Throws
if the array is empty.
Samples
samples.collections.Collections.Aggregates.maxByReturns the first element yielding the largest value of the given function.
Since Kotlin
1.7Throws
if the collection is empty.
Samples
samples.collections.Collections.Aggregates.maxByinline fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(selector: (Map.Entry<K, V>) -> R): Map.Entry<K, V>(source)
Returns the first entry yielding the largest value of the given function.
Since Kotlin
1.7Throws
if the map is empty.
Samples
samples.collections.Collections.Aggregates.maxByinline fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(selector: (Map.Entry<K, V>) -> R): Map.Entry<K, V>?(source)
Deprecated
Warning since 1.4
Error since 1.5
Hidden since 1.6
Use maxByOrNull instead.
Replace with
this.maxByOrNull(selector)
Content copied to clipboard
Since Kotlin
1.0Deprecated
Warning since 1.4
Error since 1.5
Hidden since 1.6
Use maxByOrNull instead.
Replace with
this.maxByOrNull(selector)
Content copied to clipboard