I have 2 sets s1
and s2
one condition is s1 > s2
.
And my requirement is i can't make change in s1
. and find difference of both set we can use another set to store result.
Set<String> s1 = new HashSet<String>();
s1.add("a");
s1.add("b");
s1.add("c");
s1.add("n");
s1.add("d");
Set<String> s2 = new HashSet<String>();
s2.add("b");
s2.add("d");
s2.add("c");
i want outpur like this
like s3= set1-set2
output :
s3=[a,n]
s1
and s2
both are huge set above 10000 elements and in loop. so i don't want to first copy s1
to s3
and then remove s2
.