Here you can find the source of getLast(List
public static <T> T getLast(List<T> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> T getLast(List<T> list) { return list.get(lastIndex(list.size())); }/* w ww . j a v a 2s. com*/ public static int lastIndex(int size) { return size - 1; } }