Kotlin HashSet maxByOrNull()
Syntax & Examples


Syntax of HashSet.maxByOrNull()

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

fun <T, R : Comparable<R>> Iterable<T>.maxByOrNull( selector: (T) -> R ): T?

This maxByOrNull() extension function of HashSet returns the first element yielding the largest value of the given function or null if there are no elements.