20165305 Su Zhenlong's eighth week study summary of "Java Programming"

Chapter 12

The reference object of this in the Lambda expression and the receiver of toString() come from the surrounding environment of the Lambda, that is, depending on which name category the Lambda expression is in, you can refer to the names in that category, such as variables or methods
JDK8 provides the feature of method reference, which can reuse the byLength method
Lambda expression is just a way to define function interface operations. In addition, as long as the method signature of a static method has the same parameters as the return value definition, static methods can also be used to define function interface operations.
Method reference not only avoids repeated writing of Lambda expressions, but also makes the program code clearer
Lambda expressions themselves are neutral and do not represent instances of any type. The same Lambda expressions can be used to represent object operations of different target types.
If the local variables captured in the lambda expression are themselves equivalent to final local variables, you can do not need to add fianl to the local variables
Lambda expression is just a way to define function interface operations. In addition, as long as the method signature of a static method has the same parameters as the return value definition, static methods can also be used to define function interface operations.
Captured local variables cannot be changed in lambda expressions
In JDK, if the variable itself is equivalent to a final local variable, that is, if the variable will not be re-specified in the anonymous class, the final keyword can be omitted.

code hosting

Script screenshot

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326353482&siteId=291194637