Let's have a class Player(val position: Int, val time: Float) and we want to sort an array or list of players by position. If some of these players have the same position after first sorting, we want to sort them by time in groups. By group I mean set of players with the same position.
I know about
list.sortedWith(compareBy<Foo> { it.a }.thenByDescending { it.b }.thenBy { it.c })
But of course it does not solve this case.
Is there any smart way in Kotlin to achieve this simple task? We can sort it manually by checking positions and swapping items, but I wonder if Kotlin has something to say in this case.
sortedWithsolve this case?