I want to sort a collection of objects in descending order.
Below code is working to sort the itemDetails object in ascending order.
Arrays.sort(itemDetails, (a, b) ->
String.valueOf(a.getAvailableQuantity())
.compareTo(String.valueOf(b.getAvailableQuantity())));
But I wanted the output in descending order.