Here you can find the source of reverse(List
public static <T> List<T> reverse(List<T> list)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> List<T> reverse(List<T> list) { int size = list.size(); for (int i = 0; i < size; i++) { int ih = i; int it = size - 1 - i; if (ih == it || ih > it) { break; }/*from www. j ava 2 s . c o m*/ T ah = list.get(ih); T swap = list.get(it); list.set(ih, swap); list.set(it, ah); } return list; } }