/** Creates a deep copy of a HashSet<TIntHashSet>. */ public static HashSet<TIntHashSet> deepClone(HashSet<TIntHashSet> set) { HashSet<TIntHashSet> clone = new HashSet<TIntHashSet>(); for (TIntHashSet elements : set) { TIntHashSet newElements = new TIntHashSet(elements.capacity()); newElements.addAll(elements); clone.add(newElements); } return clone; }
/** Computes the union of two arrays. */ public static int[] union(int[] a, int[] b) { TIntHashSet set = new TIntHashSet(); set.addAll(a); set.addAll(b); return set.toArray(); }