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
You can do like this:
List yourList = new ArrayList();
Collections.sort(yourList, Collections.reverseOrder());
Collection has a default Comparator that can help you with that.
Also, if you want to use some Java 8 new features, you can do like that:
List yourList = new ArrayList();
yourList = yourList.stream().sorted(Collections.reverseOrder()).collect(Collectors.toList());