This is mainly a performance questions. I have a master list of all users existing in a String array AllUids. I also have a list of all end dated users existing in a String
String s1 = "a,b,c,d";
String s2 = "x,y,z,a,b,c";
Set set1 = new HashSet();
Set set2 = new HashSet();
Set set11 = new HashSet();
String[] splitS1 = s1.split(",");
String[] splitS2 = s2.split(",");
for(String s3:splitS1){
set1.add(s3);
set11.add(s3);
}
for(String s4:splitS2){
set2.add(s4);
}
set1.removeAll(set2);
set2.removeAll(set11);
set1.addAll(set2);
System.out.println(set1);