1import java.util.*;
2public class Details {
3
4 public static void main(String args[]){
5 ArrayList<String> arraylist = new ArrayList<String>();
6 arraylist.add("AA");
7 arraylist.add("ZZ");
8 arraylist.add("CC");
9 arraylist.add("FF");
10
11 /*Unsorted List: ArrayList content before sorting*/
12 System.out.println("Before Sorting:");
13 for(String str: arraylist){
14 System.out.println(str);
15 }
16
17 /* Sorting in decreasing order*/
18 Collections.sort(arraylist, Collections.reverseOrder());
19
20 /* Sorted List in reverse order*/
21 System.out.println("ArrayList in descending order:");
22 for(String str: arraylist){
23 System.out.println(str);
24 }
25 }
26}