I'm new to Kotlin and need to ask some questions about ordering a MutableList<MyObject>
. As I understand it, I can do a myMutableList.sortBy {it.int}
and a myMutableList.sortByDescending {it.int}
for both Int
and String
. But return is always a Unit
and not a MutableList
.
Where am I going wrong and how do I proceed?