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.Collection; import java.util.List; public class Main { public static <T> T first(List<T> list) { return isNullOrEmpty(list) ? null : list.get(0); }/* www .j a v a 2 s. com*/ public static boolean isNullOrEmpty(Collection<?> collection) { return collection == null || collection.isEmpty(); } }