Here you can find the source of firstItem(List
public static <T> T firstItem(List<T> items)
//package com.java2s; /*/*from www . j a va 2 s .co m*/ * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. * * Copyright (c) 2014, Gluu */ import java.util.Iterator; import java.util.List; public class Main { public static <T> T firstItem(List<T> items) { if (items == null) { return null; } Iterator<T> iterator = items.iterator(); if (iterator.hasNext()) { return iterator.next(); } return null; } }