Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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;
}
Source by www.queryhome.com #
 
PREVIOUS NEXT
Tagged: #reverse #arraylist #java #recursion
ADD COMMENT
Topic
Name
3+6 =