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
[HD-OCP17/21-Fundamentals Pg 490, Sec. 17.1.6 - the-sort-method]
Moderator: admin
-
- Posts: 167
- Joined: Sun Apr 21, 2024 10:43 am
- Contact:
-
- Site Admin
- Posts: 10398
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD-OCP17/21-Fundamentals Pg 490, Sec. 17.1.6 - the-sort-method]
Yes, that is fine too.
Who is online
Users browsing this forum: No registered users and 18 guests