Here you can find the source of getLast(List
public static <T> T getLast(List<T> source)
//package com.java2s; /*/*from ww w. j a v a2 s .c om*/ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - Initial contribution * * Contributors: * * Description: This file is part of com.nokia.tools.vct.common.core component. */ import java.util.List; public class Main { public static <T> T getLast(List<T> source) { return source.isEmpty() ? null : source.get(source.size() - 1); } }