KT-20357 Add samples for maxBy and minBy
This commit is contained in:
@@ -147,6 +147,8 @@ public inline fun <K, V> Map<out K, V>.forEach(action: (Map.Entry<K, V>) -> Unit
|
||||
|
||||
/**
|
||||
* Returns the first entry yielding the largest value of the given function or `null` if there are no entries.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.maxBy
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun <K, V, R : Comparable<R>> Map<out K, V>.maxBy(selector: (Map.Entry<K, V>) -> R): Map.Entry<K, V>? {
|
||||
@@ -163,6 +165,8 @@ public inline fun <K, V> Map<out K, V>.maxWith(comparator: Comparator<in Map.Ent
|
||||
|
||||
/**
|
||||
* Returns the first entry yielding the smallest value of the given function or `null` if there are no entries.
|
||||
*
|
||||
* @sample samples.collections.Collections.Aggregates.minBy
|
||||
*/
|
||||
public inline fun <K, V, R : Comparable<R>> Map<out K, V>.minBy(selector: (Map.Entry<K, V>) -> R): Map.Entry<K, V>? {
|
||||
return entries.minBy(selector)
|
||||
|
||||
Reference in New Issue
Block a user