reverse arraylist java recursion code example
Example: reverse arraylist java recursion
public ArrayList<Object> reverse(ArrayList<Object> arrayList) {
if(arrayList.size() > 1) {
Object value = arrayList.remove(0);
reverse(arrayList);
arrayList.add(value);
}
return arrayList;
}