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
In JAVA 8 its much easy now.
List alphaNumbers = Arrays.asList("one", "two", "three", "four");
List alphaNumbersUpperCase = alphaNumbers.stream()
.map(String::toUpperCase)
.sorted()
.collect(Collectors.toList());
System.out.println(alphaNumbersUpperCase); // [FOUR, ONE, THREE, TWO]
-- For reverse use this
.sorted(Comparator.reverseOrder())