Here you can find the source of toReverse(List
public static <T> List<T> toReverse(List<T> list)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class Main { public static <T> List<T> toReverse(List<T> list) { List<T> ret = new ArrayList<>(list.size()); for (Iterator<T> itr = new LinkedList<>(list).descendingIterator(); itr.hasNext();) { T obj = itr.next();/*from w w w. j av a2 s . c om*/ ret.add(obj); } return ret; } }