// Create two sets.
Set s1 = new HashSet();
s1.add("Ian Darwin");
s1.add("Bill Dooley");
s1.add("Jesse James");
Set s2 = new HashSet();
s2.add("Ian Darwin");
s2.add("Doolin' Dalton");
Set union = new TreeSet(s1);
union.addAll(s2); // now contains the union
print("union", union);
Set intersect = new TreeSet(s1);
intersect.retainAll(s2);
print("intersection", intersect);