Kotlin HashSet maxOfWithOrNull()
Syntax & Examples


Syntax of HashSet.maxOfWithOrNull()

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

fun <T, R> Iterable<T>.maxOfWithOrNull( comparator: Comparator<in R>, selector: (T) -> R ): R?

This maxOfWithOrNull() extension function of HashSet returns the largest value according to the provided comparator among all values produced by selector function applied to each element in the collection or null if there are no elements.