You can use the utility method in Collections
class
public static <T extends Comparable<? super T>> void sort(List<T> list)
or
public static <T> void sort(List<T> list,Comparator<? super T> c)
Refer to Comparable
and Comparator
interfaces for more flexibility on sorting the object.