Reverse an ArrayList
public ArrayList<Integer> reverse(ArrayList<Integer> list) { for(int i = 0, j = list.size() - 1; i < j; i++) { list.add(i, list.remove(j)); } return list; }
remove(int index)
Removes the element at the specified position in this list. Return the element.