Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static <E> List<E> toList(Iterable<? extends E> iterable) { final List<E> list = new ArrayList<E>(); for (E e : iterable) { list.add(e); } return Collections.unmodifiableList(list); } }