There are two TreeSet
s in my app:
set1 = {501,502,503,504}
set2 = {502,503,504,505}
I want to get the symmetric difference of thes
if we use package com.google.common.collect, we may ellegantly find symmetric difference like this :
Set s1 = Stream.of( 1,2,3,4,5 ).collect( Collectors.toSet());
Set s2 = Stream.of( 2,3,4 ).collect( Collectors.toSet());
System.err.println(Sets.symmetricDifference( s1,s2 ));
The output will be : [1, 5]