To make an object comparable, we need to implement either the comparable interface and implement the compareTo method, or use the Comparator interface and implement its compare method.
In this video we work with in Item object, which can be sorted by id, price and object name.
You might need to sort an array lists in various cases, for example: to rearrange the order of a list that feeds your Recycler View component.
If you have any questions and comments, please leave them in the section below.
Thank you for watching!
0 Comments