Here you can find the source of getFirst(List
public static <T> T getFirst(List<T> source)
//package com.java2s; /*/*from w w w. ja v a 2 s . c o m*/ * 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 getFirst(List<T> source) { return source.isEmpty() ? null : source.get(0); } }