make method static: convert method reference to lambda (IDEA-191425)

This commit is contained in:
Anna.Kozlova
2018-05-16 13:43:27 +02:00
parent c258895a08
commit 6786d754e3
4 changed files with 68 additions and 6 deletions
@@ -0,0 +1,20 @@
import java.util.function.Function;
class Foo {
Bar frobnitz(Function<Foo, Bar> f) {
return f.apply(this);
}
}
class Bar {
static Bar frob(Bar anObject, Foo foo) {
return anObject;
}
}
class Baz {
public static void main(String[] args) {
Bar bar = new Bar();
new Foo().frobnitz(foo -> Bar.frob(bar, foo));
}
}