Java 8 method reference
•
Java
summary
A method reference is a method or constructor used to directly access the existence of a class or instance It requires a target type context consisting of compatible functional interfaces (interfaces used in lambda expressions) Sometimes, when we want to implement a method with a functional interface, but the function we want has been implemented by the class, we can use the method reference to directly use the existing function implementation
You can see this article about lambda expressions
When a lambda expression only executes a method call, it is called directly in the form of method reference Method reference is a more concise lambda expression
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码