Kotlin HashSet distinctBy()
Syntax & Examples


Syntax of HashSet.distinctBy()

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

fun <T, K> Iterable<T>.distinctBy( selector: (T) -> K ): List<T>

This distinctBy() extension function of HashSet returns a list containing only elements from the given collection having distinct keys returned by the given selector function.