Here you can find the source of listOf(Iterable
public static <T> List<T> listOf(Iterable<T> it)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.LinkedList; import java.util.List; public class Main { /**//from www .j a v a2s .c om * Returns a list form the the specified {@link Iterable}. * If the specified {@link Iterable} is yet a {@link List} than it * is returned as is, otherwise a brand new {@link List} is created. */ public static <T> List<T> listOf(Iterable<T> it) { if (it instanceof List) { return (List<T>) it; } final List<T> result = new LinkedList<T>(); for (final T t : it) { result.add(t); } return result; } /** * @see #listOf(Iterable) */ public static <T> List<T> listOf(T... items) { return Arrays.asList(items); } }