guys, how do i reverse this: ```return this.sorted...
# announcements
m
guys, how do i reverse this:
Copy code
return this.sortedWith(
                compareBy(
                        { it.isFriendOnline },
                        { it.presenceMode },
                        { it.gameStatus },
                        { it.name }
                )
        )
i want to reverse the sorting order without creating a new list. apparently, swapping the comparators order won’t work
c
you could invert all the comparators
m
Cannot invert
String
and gameStatus (int or enum).
m
yes the problem are enums
i
Use
Comparator.reversed
function to get the compartor of inverted order
👍 2
m
ok. thanks