Here you can find the source of first(final List
public static <T> T first(final List<T> list)
//package com.java2s; import java.util.List; public class Main { /** Gets the first element of the given list, or null if none. */ public static <T> T first(final List<T> list) { if (list == null || list.size() == 0) return null; return list.get(0); }/*from ww w .ja v a 2 s. co m*/ }