Here you can find the source of removeLast(List
public static <T> T removeLast(List<T> aList)
//package com.java2s; import java.util.*; public class Main { /**/*from w ww.j av a2 s.co m*/ * Removes the last object from given list. */ public static <T> T removeLast(List<T> aList) { return aList.remove(aList.size() - 1); } /** * Removes given object from given list (accepts null list). */ public static boolean remove(List aList, Object anObj) { return aList == null ? false : aList.remove(anObj); } /** * Removes range of objects from given list (from start to end, not including end). */ public static void remove(List aList, int start, int end) { for (int i = end - 1; i >= start; i--) aList.remove(i); } /** * Returns the size of a list (accepts null list). */ public static int size(List aList) { return aList == null ? 0 : aList.size(); } }