I have a List of doubles in java and I want to sort ArrayList in descending order.
Input ArrayList is as below:
List testList = new Arr
if you are using Java SE 8, then this might be of help.
//create a comparator object using a Lambda expression
Comparator compareDouble = (d1, d2) -> d1.compareTo(d2);
//Sort the Collection in this case 'testList' in reverse order
Collections.sort(testList, Collections.reverseOrder(compareDouble));
//print the sorted list using method reference only applicable in SE 8
testList.forEach(System.out::println);