import javafx.animation.SequentialTransition;
import java.util.*;
public class Sets {
//求并集
public static Set union(Set a, Set b) {
Set result = new HashSet(a);
result.addAll(b);
return result;
}
//求交集
public static Set intersection(Set a, Set b) {
Set result = new HashSet(a);
result.retainAll(b);
return result;
}
//求差集
public static Set difference(Set a, Set b) {
Set result = new HashSet<>(a);
result.removeAll(b);
return result;
}
//求交集外所有元素
public static Set complement(Set a, Set b) {
return difference(union(a,b),intersection(a,b));
}
}