I am newbie in java...I want to do intersection and union set
program...I have a set data in list like [ [abc] [ac] [abc] [b] [a] ]
For the first three set....it can do intersection and get new set as
[ac] but when find [b] it will return [ ]...I want it return [ac]
[b]..and then find [a] it will return [c][b]...anyone could help me...
Below is my program :
public static void intersect(List listSet2) {
Set inter = new HashSet((Set)listSet2.get(0));
Set union = new HashSet();
for (int i=1; i < listSet2.size(); i++){
inter.retainAll((Set)listSet2.get(i));
System.out.println("Inter " + inter);
}
}