Reverse order of all elements of Java ArrayList
import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("A"); arrayList.add("B"); arrayList.add("C"); arrayList.add("D"); arrayList.add("E"); System.out.println(arrayList); Collections.reverse(arrayList); System.out.println(arrayList); } }