Kotlin HashSet sortedBy()
Syntax & Examples


Syntax of HashSet.sortedBy()

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

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

This sortedBy() extension function of HashSet returns a list of all elements sorted according to natural sort order of the value returned by specified selector function.