将数组转换为集合
//package com.nowjava; /** * 时代Java 提 供 **/ import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; public class Main { @SafeVarargs public static <E> Set<E> asSet(E... elements) { if (elements == null || elements.length == 0) { return Collections.emptySet(); } /* n o w j a v a . c o m - 时 代 Java 提 供 */ LinkedHashSet<E> set = new LinkedHashSet<E>(