public static <T> Set<T> intersection(final Set<T> setA, final Set<T> setB) {
        final Set<T> tmp = new HashSet<T>();
        for (final T x : setA) {
            if (setB.contains(x)) {
                tmp.add(x);
            }
        }
        return tmp;
    }