Java examples for Collection Framework:HashSet
get Union of two HashSet
//package com.java2s; 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);/*from w w w . ja v a2s.c om*/ set.addAll(set2); return set; } }