Mikael Ståldal
01/31/2023, 10:09 AMmyList.groupingBy { it }.eachCount().toList().sortedBy { it.second }
Is there any shorter and/or more efficient way of doing this? Maybe some shortcut for groupingBy { it }
?Klitos Kyriacou
01/31/2023, 12:07 PMmyList.groupingBy { it }.eachCount().entries.sortedBy { it.value }
(Also, it returns a List<Map.Entry>
instead of a List<Pair>
.)