Here you can find the source of iterable2List(Iterable
public static <E> List<E> iterable2List(Iterable<E> iterable)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static <E> List<E> iterable2List(Iterable<E> iterable) { if (iterable instanceof List) { return (List<E>) iterable; }//from ww w. ja va 2s .c om ArrayList<E> list = new ArrayList<E>(); if (iterable != null) { for (E e : iterable) { list.add(e); } } return list; } }