Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { public static <E> Set<E> union(Set<? extends E> x, Set<? extends E> y) { Set<E> union = new HashSet<E>(); union.addAll(x); union.addAll(y); return union; } }