Method References In JAVA 8
Method References : Method reference is an important feature related to lambda expressions. It provides a way to a method without executing it. In order to that a method reference requires a target type context that consists of a compatible functional interface. Similar to lambda expressions, a method reference when evaluated creates an instance of the functional interface. The 3 types of method references are, 1. Static Method References. 2. Instance Method References Of Objects. 3. Instance Method References Of Classes. In the first two types, the method reference is equivalent to a lambda expression on which parameters of a method will be supplied. In the 3rd type, the 1st parameter of a method becomes the target of the method and second parameter becomes argument to the method just like s1.equals(s2); . Static Method References : The syntax for static method references is ClassName :: methodName Lets see a simple example to understand st...