public HashSet<T> union(HashSet<T> u) { HashSet<T> n = new HashSet<T>(this); Iterator<T> e = u.iterator(); while (e.hasNext()) n.add(e.next()); return n; }
/** * Add the elements of another HashSet to this HashSet. * * @param hs the HashSet from which the new elements are obtained */ public void add(HashSet<T> hs) { Iterator<T> e = hs.iterator(); while (e.hasNext()) this.add(e.next()); }