In this video we will see how to make an object comparable and sort the array lists using the comparable and comparator interfaces.
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!
~-~~-~~~-~~-~
Please watch: "Tutorial - How to Create an Old Film Look Effect in DaVinci Resolve 16"
• Tutorial - How to Create an Old Film ...
~-~~-~~~-~~-~