Java examples for java.util:Set Intersection
intersection two sets
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> intersection(Set<T> set1, Set<T> set2) { Set<T> intersection = new HashSet<T>(set1); intersection.retainAll(set2);// w ww.ja v a2 s . c o m return intersection; } }