Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java remove numbers from 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);
    }
 
PREVIOUS NEXT
Tagged: #java #remove #numbers #set
ADD COMMENT
Topic
Name
4+1 =