class CollectionFunctions {

    public static <T> Set<T> flattenSets(Set<Set<T>> lists) {
        return lists.stream()
                .filter(Objects::nonNull)
                .flatMap(Collection::stream)
                .collect(toSet());
    }

    private  CollectionFunctions();

}