While output like Java 8 seems much improved, I hit a possible limitation, and I'm not sure if there is any workaround that I am missing. Scenario:
class Foo<T> { <U> void apply(Function<T, Consumer<U>> bar) {} } class Bar { void setBar(String bar){} } Foo<Bar> foo = new Foo<>();
It works:
foo.<String>apply(bar -> bar::setBar);
It does not mean:
foo.apply(bar -> bar::setBar);
Is there a way to get type inference to work in a similar situation?
java lambda java-8 type-inference
Josh stone
source share