I've to deal with an external library which accepts Object as Parameter only.
A method signature like this: ExternalObj.setValue(Object object)
My Question is why exactly do I need the stupidWrapper below?
public class FuntionTest {
public class Foo{
private Object thing;
public void setObject(Object thing){
this.thing=thing;
}
public void call(){
((Function)thing).apply("FOOO");
}
public <R,T> Function<R,T> stupidWrapper(Function<R,T> function){
return function;
}
}
@Test
public void testFunction(){
Foo foo = new Foo();
foo.setObject(
foo.stupidWrapper(
(baz) -> {
System.out.println(baz);
return null;
}));
foo.call();
}
Why can't I use the lamba directly?