union of two hashsets java code example
Example 1: set union java
set1.retainAll(set2); // Intersection
Example 2: set union java
set1.addAll(set2); // Union
set1.retainAll(set2); // Intersection
set1.addAll(set2); // Union