20165305 Suzhenrong "Java Programming" Eighth Week study summary

Source: Internet
Author: User
In the 12th chapter, the Reference object of this in the lambda expression and the recipient of ToString () are from the surrounding environment of the lambda, that is, to see the name of the lambda expression in the category, you can refer to the name within that category, such as a variable or method JDK8 provides a method reference to the characteristics , you can reuse the Bylength method lambda expression is just a way to define the function interface operation, in addition, as long as the method of the static method is signed, the parameter is the same as the return value definition, you can also use a static method to define the function interface operation method reference not only avoids repeating the lambda expression, You can also make the program code clearer that the lambda expression itself is neutral, does not represent any type of instance, and the same lambda expression that can be used to represent object operations of different target types if the local variable captured in the lambda expression is itself equivalent to the final local variable, Instead of adding a FIANLLAMBDA expression to a local variable, you can simply define a way for the function interface operation, except that the parameter is the same as the return value definition in the method signature of the static method. You can also use static methods to define function interface operations in a lambda expression, you cannot change the value of a captured local variable in the JDK, if the variable itself is equivalent to the final local variable, that is, if the variable no longer has a re-specified action in the anonymous class, You don't have to add the final keyword code to the managed script

20165305 Suzhenrong "Java Programming" Eighth Week study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.