Kotlin HashMap maxByOrNull()
Syntax & Examples


Syntax of HashMap.maxByOrNull()

The syntax of HashMap.maxByOrNull() extension function is:

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

This maxByOrNull() extension function of HashMap returns the first entry yielding the largest value of the given function or null if there are no entries.