asad.awadia
03/03/2019, 1:37 AM[(1,2) , (3,4), (1,2)] should return [(1,2),(3,4)]ilya.gorbunov
03/03/2019, 2:10 AMpairs.distinct() and then sorting by your criteria help?asad.awadia
03/03/2019, 2:11 AMasad.awadia
03/03/2019, 4:31 AMasad.awadia
03/03/2019, 4:32 AMasad.awadia
03/03/2019, 4:32 AMasad.awadia
03/03/2019, 6:41 AMmarcinmoskala
03/03/2019, 1:10 PMlistOf(1 to 2, 2 to 3, 1 to 2)
        .groupBy { it }
        .toList()
        .sortedBy { it.second.size }
        .flatMap { it.second } // Or if you want distinct then .map { it.first }orangy
listOf(1 to 2, 2 to 3, 1 to 2).groupingBy { it }.eachCount() should be better performance-wiseasad.awadia
03/03/2019, 10:06 PMasad.awadia
03/03/2019, 10:06 PMorangy
asad.awadia
03/03/2019, 10:06 PMasad.awadia
03/03/2019, 10:08 PMilya.gorbunov
03/03/2019, 11:32 PMworth adding as sequence?if these are all operations on the list, then it isn't.
Also what is the difference between groupBy and groupingBy
groupBy immediately produces a map of keys to lists of grouped values, and groupingBy allows to apply an aggregating operation to an each list on-the-fly, so the resulting map maps keys to the aggregation result of an each group.asad.awadia
03/03/2019, 11:40 PMall operations on a list? When are they not? Do you mean things like map/sets?
ilya.gorbunov
03/04/2019, 12:09 AMasad.awadia
03/04/2019, 12:14 AMasad.awadia
03/04/2019, 12:14 AM