In this tutorial, I am going to show you, how to sort lists. I will be showing examples for
1. Sorting objects that implement Comparable
2. Sorting objects that don't implement Comparable
Sorting objects that implement Comparable
We can sort java.util.List using a java utility class java.util.Collections. We will use a static method sort(List) of the java.util.Collections. From Java docs of