class _Sets {

    public static <T> Set<T> intersect(@Nullable Set<T> a, @Nullable Set<T> b) {
        if(a==null && b==null) {
            return Collections.emptySet();
        }
        if(a==null || b==null) {
            return Collections.emptySet();
        }
        return a.stream()
                .filter(Objects::nonNull)
                .filter(b::contains)
                .collect(toUnmodifiable());
    }

}