Here you can find the source of reverse(List
public static <T> List<T> reverse(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> reverse(List<T> list) { List<T> tmp = new ArrayList<T>(list); list.clear();/*from w w w .j ava 2 s . c om*/ for (int index = tmp.size() - 1; index >= 0; index--) { list.add(tmp.get(index)); } return list; } }