Java List Last Item getLast(List source)

Here you can find the source of getLast(List source)

Description

get Last

License

Open Source License

Declaration

public static <T> T getLast(List<T> source) 

Method Source Code

//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);
    }
}

Related

  1. getLast(List list)
  2. getLast(List list)
  3. getLast(List list)
  4. getLast(List list)
  5. getLast(List list)
  6. getLast(List list)
  7. getLastBefore(List list)
  8. getLastDateFromTimeSeriesDeltas(Double xAxisStart, List xAxisDeltas)
  9. getLastElement(List list)