DistinctBy documentation is misleading


#1

The DistinctBy documentation https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/distinct-by.html says ‘Returns a list containing only elements from the given array having distinct keys returned by the given [selector]’

It should say “returns the first element in the list for every computed value of the selector”:

>>> listOf("aa", "ab", "bc").distinctBy{ it[0] }
[aa, bc]

The current documentation says this example should only return “bc” because that’s the only entry with a distinct key.