Given the code fragment:
List colors = Arrays.asList(“red”, “green”, “yellow”);
Predicate test = n - > {
System.out.println(“Searching…”);
return n.contains(“red”);
};
colors.stream()
.filter(c -> c.length() >= 3)
.allMatch(test);
What is the result?
Searching…
Searching…Searching…
Searching…Searching…Searching…
A compilation error occurs.
Submit