Here you can find the source of first(Collection
private static <T> T first(Collection<T> c)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { private static <T> T first(Collection<T> c) { return c.iterator().next(); }//from w ww . j av a 2 s .co m }