Kotlin HashMap maxOfWithOrNull()
Syntax & Examples


Syntax of HashMap.maxOfWithOrNull()

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

fun <K, V, R> Map<out K, V>.maxOfWithOrNull( comparator: Comparator<in R>, selector: (Entry<K, V>) -> R ): R?

This maxOfWithOrNull() extension function of HashMap returns the largest value according to the provided comparator among all values produced by selector function applied to each entry in the map or null if there are no entries.