What is the simplest way to reverse this ArrayList?
ArrayList aList = new ArrayList<>();
//Add elements to ArrayList object
aList.add(\
Not the simplest way but if you're a fan of recursion you might be interested in the following method to reverse an ArrayList:
public ArrayList
Or non-recursively:
public ArrayList reverse(ArrayList list) {
for(int i = 0, j = list.size() - 1; i < j; i++) {
list.add(i, list.remove(j));
}
return list;
}