Пример #1
0
 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;
 }
Пример #2
0
 /**
  * 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());
 }