As per Documentation: -
1. The first argument is the list which need to be sorted
sort(List<T> list, Comparator<? super T> c)
2. The second argument is the object of class implementing Comparator interface. This will determine the ordering of the elements in your list.
you can use this too "sort(List<T> list)", but in that case the elements of the list should be comparable, i.e. they should implement Comparable interface and their comparison done by compareTo method should not throw ClassCastException