Which can fill in the blank so this code outputs true?
import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) { Stream<Boolean> hide = Stream.of(true, false, true); boolean found = hide.filter(b -> b). (); System.out.println(found);/*from www.j av a2s. c o m*/ } }
A. Only anyMatch B. Only allMatch C. Both anyMatch and allMatch D. The code does not compile with any of these options.
D.
Both anyMatch()
and allMatch()
take a Predicate as a parameter.
This code does not compile because the parameter is missing.