Method Reference In Java 8 - How it really works ?

Published 2024-07-26
In this video, We will learn about the method reference in java 8 and how it really works.

Method references are introduced first in Java 8 and they can substitute a Single line lambda where within a lambda we just call a method.

Method reference in java are very readable helps to write clean code.

In this video We will learn the following :
1. what are Method references in Java ?
2. Difference Between Anonymous inner class, Lambda expressions and method references
3. Need of Method references in Java
4. How can we use method reference in Real time
5. We will be pretty much talking about using static method reference in this video.
6. Method reference can also be used for instance method and constructor and we will be talking about it in our next video.

timestamp
-------------------
00:00 - What is method reference in Java ?
08:39 - static method reference in java 8
24:07 - When should we use method reference over lambda ?
31:16 - method reference : return type confusion
49:15 - refer to sort() Using Consumer
52:49 - refer to sum() using BiFunction
58:16 - refer to equals() using BiPredicate
01:02:07 - A tricky usecase using Function and Consumer
01:08:38 - System.out::println
01:12:28 - The Climax Mystery - String :: upperCase ?

For more free/paid courses visit
www.seleniumexpress.com/

LINKS AND FREE LEARNING RESOURCES
========
Watch my new mock interview series for java developers
   • Java interview questions and answers ...  

Watch my new Hello spring boot series
   • Spring Vs Spring Boot - Why Spring Bo...  

Watch Spring boot Hot topics
   • @Reposicotry Vs @Service | Spring Boo...  

spring core
   • Spring framework tutorial for beginne...  

spring mvc
   • Spring MVC course introduction || Und...  

spring mvc intermediate
   • [INTERMEDIATE] Spring MVC Course Prev...  

Spring JDBC
   • Spring JDBC Course Preview || Let’s t...  

spring live project
   • #1 Build and Deploy A Spring Project ...  

SPRING SECURITY COURSE[NEW]
   • Spring Security Course Preview | Lear...  

For more courses visit
www.seleniumexpress.com/

Any time you are getting stuck with issues, Feel free to ask for support.
You can send mail to [email protected]

you can ping me on my Facebook page
www.facebook.com/seleniumexpress

Make sure to join my private Facebook page (Ask me here)
“SeleniumExpress - Support"
www.facebook.com/groups/187000222361579/

you can ask for support in my website forum
www.seleniumexpress.com/

Follow me on Insta
www.instagram.com/selenium_express/

All Comments (18)
  • It's like a twist buster at the end, you have mentioned it would work only static and method arguments should match, but the end it it worked with String::UpperCase, which creates an enthusiasm on how it worked.
  • Its very helpful brother, I need deep knowledge of exceptions and multi threading is so helpful for us if you make videos on this 2 topic
  • Thanks a lot!! Was eagerly waiting for this. It feels like I can understand most of the things if you explain it. 👍👍
  • Hi Abhilash.. your videos are awesome... Can you take one session on generics in depth and multi threading as well
  • Learned a lot. Big fan of your content! I have a question about method references. The main purpose seems to be code reuse. Since the methods already exist, why not just call them directly using the class name or object? For instance, instead of using a method reference like Collections::sort with an interface variable, we could just use Collections.sort() wherever needed. What specific advantages do method references offer?
  • I tried to buy the microservices boot camp course on your website but it says closed. How can I buy that course. Thank you.