Here you can find the source of getLast(List
public static <T> T getLast(List<T> list)
//package com.java2s; /*/*from w w w . j a va2s . c om*/ * Commons-Utils * Copyright (c) 2017. * * Licensed under the Apache License, Version 2.0 (the "License") */ import java.util.*; public class Main { public static <T> T getLast(List<T> list) { if (isEmpty(list)) { return null; } return list.get(list.size() - 1); } public static boolean isEmpty(List<?> list) { return (list == null) || (list.isEmpty()); } }