Here you can find the source of removeLastElements(List
public static <E> void removeLastElements(List<E> list, int fromIdx)
//package com.java2s; import java.util.List; public class Main { /**/*from www. j a va 2 s . c o m*/ * fromIndex, inclusive, * and toIndex, exclusive */ public static <E> void removeLastElements(List<E> list, int fromIdx) { list.subList(fromIdx, list.size()).clear(); } }