Here you can find the source of reverseList (ArrayList
public static ArrayList <Object> reverseList (ArrayList <Object> l)
//package com.java2s; import java.util.*; public class Main { public static ArrayList<Object> reverseList(ArrayList<Object> l) { if (l == null) return null; Iterator i = l.iterator(); ArrayList<Object> result = new ArrayList<Object>(); while (i.hasNext()) { result.add(0, i.next());// ww w. j a v a 2 s .c o m } return result; } }