Java tutorial
//package com.java2s; //License from project: LGPL import java.util.HashSet; import java.util.Set; public class Main { public static <E> Set<E> intersection(final Set<E> arg1, final Set<E> arg2) { Set<E> intersect = new HashSet<>(arg1); intersect.retainAll(arg2); return intersect; } }