Skip to content

The method reference is nothing but the simplified version of the lambda expression. Instead of providing an implementation body, a method reference refers to an existing available method

Notifications You must be signed in to change notification settings

Shubh2-0/Method-References

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Method Reference

Java provides a new feature called method reference in Java 8. Method reference is used to refer method of the functional interface. It is a compact and easy form of a lambda expression. Each time when you are using a lambda expression to just referring a method, you can replace your lambda expression with a method reference.

Advantages of Method Reference

✨ It is shorter than a lambda expression

✨ It includes the name of the class, which contains the method; this improves the readability of the code.

Types of Method Reference

There are four types of method references available

1️⃣ Static Method Reference

2️⃣ Instance Method Reference

3️⃣ Arbitrary object – Instance Method Reference

4️⃣ Constructor Reference

📬 Contact

If you want to contact me, you can reach me through below handles.

linkedinmail-mewhatsapp-me


💓Happy Coding😄💻

About

The method reference is nothing but the simplified version of the lambda expression. Instead of providing an implementation body, a method reference refers to an existing available method

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages