package collection.demos;
import java.util.ArrayList;
import java.util.Collections;
public class ReversingListElements {
public static void main(String[] args) {
ArrayList<String> activities=new ArrayList<String>();
activities.add("analysis");
activities.add("design");
activities.add("development");
activities.add("testing");
activities.add("support");
System.out.println(" List : "+activities);
Collections.reverse(activities);
System.out.println("List after reversed : "+activities);
Collections.shuffle(activities);
System.out.println("List after Suffuled : "+activities);
}
}
====================================================================
OUTPUT
import java.util.ArrayList;
import java.util.Collections;
public class ReversingListElements {
public static void main(String[] args) {
ArrayList<String> activities=new ArrayList<String>();
activities.add("analysis");
activities.add("design");
activities.add("development");
activities.add("testing");
activities.add("support");
System.out.println(" List : "+activities);
Collections.reverse(activities);
System.out.println("List after reversed : "+activities);
Collections.shuffle(activities);
System.out.println("List after Suffuled : "+activities);
}
}
====================================================================
OUTPUT
List : [analysis, design, development, testing, support]
List after reversed : [support, testing, development, design, analysis]
List after Suffuled : [analysis, development, support, design, testing]
Comments