获取两个哈希集的并集
//package com.nowjava; /* nowjava.com - 时 代 Java */ import java.util.HashSet; public class Main { public static <T> HashSet<T> getUnion(HashSet<T> set1, HashSet<T> set2) { HashSet<T> set = new HashSet<T>(); set.addAll(set1); set.addAll(set2); return set; } }