Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collections; import java.util.LinkedList; import java.util.List; public class Main { public static <T> List<T> toList(Iterable<T> iterable) { if (null == iterable) return Collections.emptyList(); List<T> retList = new LinkedList<>(); for (T item : iterable) { retList.add(item); } return retList; } }