Here you can find the source of removeFirst(Iterable
public static <T> T removeFirst(Iterable<T> iterable)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static <T> T removeFirst(Iterable<T> iterable) { return removeNext(iterable.iterator()); }/*from w ww .ja va2 s. co m*/ public static <T> T removeNext(Iterator<T> iterator) { final T t = iterator.next(); iterator.remove(); return t; } }