Kotlin HashSet maxWithOrNull()
Syntax & Examples


Syntax of HashSet.maxWithOrNull()

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

fun <T> Iterable<T>.maxWithOrNull( comparator: Comparator<in T> ): T?

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