Here you can find the source of asList(Iterable
public static <T> List<T> asList(Iterable<T> iterable)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> asList(Iterable<T> iterable) { if (List.class.isAssignableFrom(iterable.getClass())) { return (List<T>) iterable; } else {//from ww w .j a va2 s .com List<T> list = new ArrayList<T>(); for (T item : iterable) { list.add(item); } return list; } } }