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) { if (list.isEmpty()) { return null; }/*w w w .j a v a 2 s. c o m*/ return list.get(0); } }