[HD-OCP17/21-Fundamentals Pg 490, Sec. 17.1.6 - the-sort-method]
Posted: Sun Sep 29, 2024 10:49 am
If you want to sort the list in the reverse order, you can change the lambda expression to, (a, b)->
-a.compareTo(b). Observe the minus sign in front of a.compareTo(b).
Or just b.compareTo(a)
dunno why you have not mentioned it
-a.compareTo(b). Observe the minus sign in front of a.compareTo(b).
Or just b.compareTo(a)
dunno why you have not mentioned it