Kotlin HashMap maxWithOrNull()
Syntax & Examples


Syntax of HashMap.maxWithOrNull()

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

fun <K, V> Map<out K, V>.maxWithOrNull( comparator: Comparator<in Entry<K, V>> ): Entry<K, V>?

This maxWithOrNull() extension function of HashMap returns the first entry having the largest value according to the provided comparator or null if there are no entries.