Question: Which lambdas can replace the method references in this code? (Choose two.) A. x.length() B. x -> x.length() C. x -> x::length D. System.out.println(s) E.
Which lambdas can replace the method references in this code? (Choose two.)

A. x.length()
B. x -> x.length()
C. x -> x::length
D. System.out.println(s)
E. s -> System.out.println(s)
F. s -> System.out::println
Stream.of("fish", "mammal", "amphibian") .map (String:: length) .findFirst() .ifPresent (System.out::println);
Step by Step Solution
3.41 Rating (151 Votes )
There are 3 Steps involved in it
The code snippet provided is using two method references in Javas Stream API Stringlength and System... View full answer
Get step-by-step solutions from verified subject matter experts
