Method Reference is another interesting feature of Java 8. Sometimes also used as an alternative of Lambda Expressions. In this session all kinds of method references are discussed with examples. Kindly watch the complete session and try all the examples to understand it completely. Happy learning Java 8 Features. Cheers, Esha
Hello, Please refer this (link - stackoverflow.com/questions/23533345/what-does-an-arbitrary-object-of-a-particular-type-mean-in-java-8) The fourth kind is where you want to call a method that is an instance method of a parameter passed to the function. With a lambda, there is no problem because you can reference the parameter variable, like this: (String someString) -> someString.toLowerCase(); However, since there is no explicit parameter variable in a method reference, the syntax used instead is: String::toLowerCase; The compiler takes the "particular type" (String) to reference the functional method (toLowerCase) contained in an "arbitrary object" (the object passed in the parameter). The term "arbitrary object" is used because the actual object passed in the parameter could be different each time the method reference is executed.
@@ThinkConstructive Thank you very much mam,i have been struggling for days to understand how this fourth type worked and how to implement it.I just wrote an example of this type of method reference on my own after reading you comment and i can't thank you enough.Please continue imparting knowledge to the community.Much love and respect to you!!I Hope you have a nice day ahead!!
Method Reference is another interesting feature of Java 8. Sometimes also used as an alternative of Lambda Expressions. In this session all kinds of method references are discussed with examples.
Kindly watch the complete session and try all the examples to understand it completely.
Happy learning Java 8 Features.
Cheers,
Esha
Nice mam
Thanks 😊
Mam your teaching of the way is awesome .
My humble request please make a video on microservices.
plZ plZ plZ 💞
Thanks 😊. Sure will plan it shortly.
Amazing video!
Thanks 😊
Hai Madam,what is the meaning of aribitary object ?
Hello,
Please refer this (link - stackoverflow.com/questions/23533345/what-does-an-arbitrary-object-of-a-particular-type-mean-in-java-8)
The fourth kind is where you want to call a method that is an instance method of a parameter passed to the function. With a lambda, there is no problem because you can reference the parameter variable, like this:
(String someString) -> someString.toLowerCase();
However, since there is no explicit parameter variable in a method reference, the syntax used instead is:
String::toLowerCase;
The compiler takes the "particular type" (String) to reference the functional method (toLowerCase) contained in an "arbitrary object" (the object passed in the parameter). The term "arbitrary object" is used because the actual object passed in the parameter could be different each time the method reference is executed.
@@ThinkConstructive Thank you very much mam,i have been struggling for days to understand how this fourth type worked and how to implement it.I just wrote an example of this type of method reference on my own after reading you comment and i can't thank you enough.Please continue imparting knowledge to the community.Much love and respect to you!!I Hope you have a nice day ahead!!