将Iterable转换为List
//package com.nowjava; import java.util.ArrayList;/*时代Java公众号 - nowjava.com*/ import java.util.Collection; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class Main { public static <T> List<T> asList(final Iterable<? extends T> iterable) { return (iterable instanceof Collection) ? new LinkedList<T>( (Collection<? extends T>) iterable) : new LinkedList<T>() { private static final long serialVersionUID = 3109256773218160485L; { if (iterable != null) { for (final T t : iterable) { add(t); }/* 来自 N o w J a v a . c o m*/ } } }; } public static <T> List<T> asList(final T t,