Question: Which method reference can replace the lambda on the first line so the output is the same? BiPredicate pred = (a,b) -> a.contains(b); System.out.println(pred.test(fish,
Which method reference can replace the lambda on the first line so the output is the same?
BiPredicate
System.out.println(pred.test("fish", "is"));
A. a::contains(b)
B. a::contains
C. String::contains(b)
D. String::contains
E. The supplied code does not compile.
F. None of the above.
Step by Step Solution
3.50 Rating (153 Votes )
There are 3 Steps involved in it
The correct answer is D Stringcontains Method references are an alternative syntax for lambda expres... View full answer
Get step-by-step solutions from verified subject matter experts
