/** * @param set * @return */ public Set<T> difference(final Set<T> set) { final Set<T> difference = new Set<T>(elements); difference.differ(set); return difference; }
/** * @param set * @return */ public Set<T> intersection(Set<T> set) { final Set<T> intersection = new Set<T>(elements); intersection.intersect(set); return intersection; }
/** * @param set * @return */ public Set<T> union(final Set<T> set) { final Set<T> union = new Set<T>(elements); union.unite(set); return union; }
/** * @param set * @return */ public boolean equals(final Set<T> set) { return cardinality() == set.cardinality() && elements.containsAll(set.elements); }
/** * @param set * @return */ public boolean subset(final Set<T> set) { return cardinality() <= set.cardinality() && set.elements.containsAll(elements); }
/** * @param set * @return */ public Set<T> subtraction(final Set<T> set) { final Set<T> subtraction = new Set<T>(elements); subtraction.subtract(set); return subtraction; }