How to negate a filter / the "not" 📎
import java.util.List;
import static java.util.function.Predicate.*;
var languages = List.of("java", "c", "c++", "javascript");
var nonJVM = languages.stream().filter(not(l -> l.equalsIgnoreCase("java"))).toList();
System.out.println(nonJVM);
The code generates the following output:
[c, c++, javascript]