Intellij - can be replaced with method reference

Viewed 64697

Always when I use lambda expressions like this:

.map(obj -> foo.makeSomething(obj))

IntelliJ suggests: "Can be replaced with method reference...". And when I try then:

.map(Foo::makeSomething)

I get the following statement: "Non-static method cannot be referenced from a static context".

Why Idea suggests me I should use method reference if it's not correct?

1 Answers
Related