Here you can find the source of getFirst(List
public static <T> T getFirst(List<T> c)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014,2015 Hideki Yatomi * All rights reserved. This program and the accompanying materials are made * available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ import java.util.*; public class Main { public static <T> T getFirst(List<T> c) { if (c == null || c.size() == 0) return null; return c.get(0); }/*from ww w. jav a2 s . c o m*/ }