I am creating a simple program to learn about the Java Comparator class. I have sorted an Arraylist into order but now I want to sort the list in descending order b
Arraylist
If you need to use a Comparator which reverses the current order, just return a negative value in the compare method.
compare
public class ComparatorInverse implements Comparator { @Override public int compare(Object lhs, Object rhs) { return -1; } }