Here you can find the source of first(List
public static <T> T first(List<T> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> T first(List<T> list) { return isEmpty(list) ? null : list.get(0); }/*from w w w. j ava 2 s . co m*/ public static boolean isEmpty(String content) { return content == null || content.isEmpty(); } public static <T> boolean isEmpty(List<T> list) { return list == null || list.isEmpty(); } }