So if I have two sets:
Set<Integer> test1 = new HashSet<Integer>();
test1.add(1);
test1.add(2);
test1.add(3);
Set<Integer> test2 = new HashSet<Integer>();
test2.add(1);
test2.add(2);
test2.add(3);
test2.add(4);
test2.add(5);
Is there a way to compare them and only have a set of 4 and 5 returned?
If you are using Java 8, you could try something like this: