并集

欢马劈雪     最近更新时间:2020-01-02 10:19:05

461
并集
/*n o w j a v a . c o m - 时代Java 提供*/


//package com.nowjava;


import java.util.Collections;


import java.util.HashSet;


import java.util.Set;


public class Main {

    public static <T> Set<T> union(final Set<T>... elements) {

        return ((elements.length == 0) ? Collections.<T> emptySet()

                : new HashSet<T>(elements.length * elements[0].size()) {

                    private static final long serialVersionUID = -3161916411604210423L;

                    {

                        for (final
展开阅读全文