Mega Code Archive

 
Categories / Java / Collections Data Structure
 

Remove all the elements in set1 from set2 (set1 -= set2), set1 becomes the asymmetric difference of set1 and se

import java.util.HashSet; import java.util.Set; public class Main {   public static void main(String[] argv) throws Exception {     Set set1 = new HashSet();     Set set2 = new HashSet();     set1.removeAll(set2);   } }