Hello, How to sort a `ArrayList<Model>` in w...
# announcements
p
Hello, How to sort a
ArrayList<Model>
in which
Model
has an
Int
value between
1 to 10
. I need to sort them in Descending order. Can anyone help me to do this? Thanks
e
Try
list.sortedByDescending { it.value }
Of course, it returns a new list with the items sorted, it doesn't change the original list.
To change the original list, use
sortByDescending
p
Thanks a lot. !