Answer the question
In order to leave comments, you need to log in
How to convert a lambda expression into a method reference?
import static java.util.stream.Collectors.joining;
import static java.util.stream.Stream.of;
public String makeSomething(String text) {
return of(text.split(" "))
.map(f -> myMethod(f))
.collect(joining(" "));
}
Answer the question
In order to leave comments, you need to log in
this::myMethod
I don't remember if it's possible in Java to omit this at this point.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question