将Iterable转换为Set
//package com.nowjava;/**来自 时 代 J a v a - nowjava.com**/ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> asSet(final Iterable<? extends T> iterable) { return (iterable instanceof Collection) ? new HashSet<T>( (Collection<? extends T>) iterable) : new HashSet<T>() { private static final long serialVersionUID = 3109256773218160485L; { if (iterable != null) { for (final T t : iterable) {/** 来 自 时 代 Java - nowjava.com**/ add(t); } } } }; } public static <T> Set<T> asSet(final T t,