Reversing Order : Collections Sort « Collections « Java Tutorial






import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MainClass {
  public static void main(String[] a) {
    List list = new ArrayList();
    list.add("A");
    list.add("C");
    list.add("B");
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list);
  }
}
[C, B, A]








9.42.Collections Sort
9.42.1.Sorting a List
9.42.2.Reversing Order
9.42.3.Sorting a Collection containing user defined Objects
9.42.4.Keeping upper and lowercase letters together