java menghapus nomor dari set

public static void removeAllNumbersGreaterThan10(Set<Integer> set) {
        Set<Integer> collectionOfTens = new HashSet<>();
        set.stream().forEach(s -> {
            if (s > 10) {
                collectionOfTens.add(s);
            }
        });
        set.removeAll(collectionOfTens);
    }