Using union and intersection method in a HashSet
问题 I am having trouble using my custom set,MySet, using the basic function of union and intersecting. The program compiles without error but just returns an empty set. Anybody see where the problem is? public class MySet<E> extends TreeSet<E> { Set<E> set; public MySet(){ set = null; } public MySet(Set<E> set){ this.set = set; } public void union(Set<E> s){ set.addAll(s); } public void intersection(Set<E> s){ set.retainAll(s); } } Main method public class TestSet { public static void main(String