Here you can find the source of getFirstElement(List
public static <T> T getFirstElement(List<T> collection)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> T getFirstElement(List<T> collection) { return collection.iterator().next(); }//from www. j a v a 2 s . com }