I have 3 sets and i'm using sets
HashSet<String> set_1 =new HashSet<String>();
set_1.add("1");
set_1.add("2");
set_1.add("3");
HashSet<String> set_2 =new HashSet<String>();
set_2.add("4");
set_2.add("5");
set_2.add("6");
HashSet<String> set_3 =new HashSet<String>();
set_3.add("7");
set_3.add("8");
set_3.add("9");
i need to calculate the union, intersection, difference and power of these sets
i tried this with union
Set<String> uni_temp = new HashSet<String>();
uni_temp.addAll(set_1);
uni_temp.addAll(set_2);
uni_temp.addAll(set_3);
but it only makes the union of set_1
and set_2
like so
[1, 2, 3, 4, 5, 6]