Question: Java question on lambda expression. Write the following code at two blocks between start and end comment. The following code is for you to copy
Java question on lambda expression.
Write the following code at two blocks between start and end comment.

The following code is for you to copy and paste:
@Test void should_be_able_to_bind_to_instance_method() { // TODO: // please bind lambda to `instanceMethod()` in this class. // assertEquals("instanceMethod", lambda.getString()); } @Test void should_be_able_to_bind_to_static_method() { // TODO: // please bind lambda to `staticMethod()` in this class. // assertEquals("staticMethod", lambda.getString()); } private static String staticMethod() { return "staticMethod"; } private String instanceMethod() { return "instanceMethod"; }@Test void should be able_to_bind_to_instance_method() { // TODO: // please bind Lambda to 'instanceMethod()' in this class. // assertEquals( expected: "instanceMethod", lambda.getString()); } @Test void should be able_to_bind_to_static method() { // TODO: // please bind Lambda to 'staticMethod()' in this class. // assertEquals( expected: "staticMethod", Lambda.getString()); } private static String staticMethod() { return "staticMethod"; } private String instanceMethod() { return "instanceMethod"; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
