Here you can find the source of reverse(List
private static <T> List<T> reverse(List<T> a)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { private static <T> List<T> reverse(List<T> a) { List<T> r = new ArrayList<T>(); for (int i = a.size() - 1; i >= 0; i--) { r.add(a.get(i));//from w w w.j av a 2 s. co m } return r; } }