Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort List in reverse in order

I have List list1 in direct order. List<String> list = Ordering.natural().sortedCopy(asu2);

How to change order. And I don't know how to rewrite methods from extends class, please write with examples or speak clearly.

like image 623
Eldar Nezametdinov Avatar asked Aug 06 '13 06:08

Eldar Nezametdinov


People also ask

How do you sort elements in reverse order in Python?

sort() method sorts the elements of a list in ascending or descending order using the default < comparisons operator between items. Use the key parameter to pass the function name to be used for comparison instead of the default < operator. Set the reverse parameter to True, to get the list in descending order.


1 Answers

Use this:

Collections.reverse(list); 
like image 147
morgano Avatar answered Sep 20 '22 15:09

morgano