Java List First Item getFirst(List source)

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

Description

get First

License

Open Source License

Declaration

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

Method Source Code

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

Related

  1. getDependenciesPrivate(List projects, boolean firstDependencies)
  2. getFirst(List c)
  3. getFirst(List l)
  4. getFirst(List list)
  5. getFirst(List list)
  6. getFirstAsString(Map> multiValueMap, String key)
  7. getFirstColumn(List> llo, String reason)
  8. getFirstDuplicateValue(List values)
  9. getFirstElement(List list)