The elements of List are shown in order they were added. There are times, when we need to sort the List in certain order. It can be done using Collections class. In this example, we can see use of Collections.sort() to sort the ArrayList.
The elements of List are shown in order they were added. There are times, when we need to sort the List in certain order. It can be done using Collections class. In this example, we can see use of Collections.sort() to sort the ArrayList.