Here you can find the source of tail(List
public static <E> List<E> tail(List<E> list, int tailLength)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static <E> List<E> tail(List<E> list, int tailLength) { if (tailLength <= 0) return Collections.emptyList(); ArrayList<E> newList = new ArrayList<E>(list); if (tailLength < list.size()) newList.subList(0, newList.size() - tailLength).clear(); return newList; }/*w w w. j a v a 2 s . c o m*/ }