Just a quick question, is there any more simpler w...
# getting-started
a
Just a quick question, is there any more simpler way to write
list.sortedBy { it }
, for a list of strings or numbers ? I know it's already pretty short but the fact that there's only
it
in the lambda feels kinda wrong
j
list.sorted()
🙂 it's available not only for lists of integers but of any
Comparable
(see doc)
👍 2
e
also potentially useful is
list.sortedWith(Comparator.getInstance())
if you want locale-sensitive string sorting
a
Dang I can't understand why I was not finding it but now I see it in the autocompletion, thanks :)