Answers for "reverse list java recursive"

0

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;
}
Posted by: Guest on November-11-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language