Sorting ArrayList in reverse in Java

You could implement a Comparator to do this, but here’s a two line solution:

Collections.sort(list);
Collections.reverse(list);

Of course this uses the default compartor, so it’s only for simple types.