The problem of method reference of lambda expression of java

I just learned to read this expression, and I feel that some places of this thing are metaphysics and I don"t understand.
A problem I just discovered is that there is a TestLambda2 class and a method in the TestLambda4 interface
class:
clipboard.png

:

clipboard.png

,static,,,:

clipboard.png

.

is established. Even if I am working on a new interface and the parameters are the same, the return type is the same, and then there is no connection, I can still quote it and ask God to give me a popular tutorial address.

Mar.23,2021
The introduction of

Lambda expression is the introduction of java to the idea of functional programming. Simply put, a method can also be assigned and passed as a variable. However, because of the object-oriented idea of java itself, the functional programming idea is implemented in the form of class.
it is recommended to read "java8 practice" for in-depth understanding.


Java is an object-oriented language, so all kinds of grammars cannot exist without the class . To see the problem, you have to see the essence through the phenomenon:

for TestLambda4 lambda4 = TestLambda2::test1 this method reference, you can understand it as:

TestLambda4 lambda4 = str -> TestLambda2.test1(str);

for Lambda expressions, although the underlying implementation is different from the anonymous inner class, the syntax functions of the two are exactly the same, that is, the above Lambda can be understood as:

TestLambda4 lambda4 = new TestLambda4() {

    @Override
    public String test111(String s) {
        return TestLambda2.test1(s);
    }
    
};
Menu