Learn Java 8 Lambda Expressions and Method References
What you will learn
Lambda Expressions
Method References
Functional Programming in Java
Default Methods
Description
Java Lambda expressions (or simply Java Lambdas) and method references are one of the major features of Java and also one of the most confusing topics in Java. In this course, we will briefly understand and experiment with Java 8 lambda expressions and method references with great examples.
The goal of this course is to get you comfortable with Lambda expressions and method references so you can answer interview questions or participate in coding interviews.
This course assumes that you know the basics of Java programming and that you can write and run Java programs.
What are Lambda expressions in Java?
Introduced in Java 8, a lambda expression is a short block of code (It looks more like an expression than a chunk of code block), which takes in parameters and returns a value. Unlike Methods, Lambda expressions do not need a name and they can be implemented right in the body of a method.
This will not only improve the code readability, but this is the first time ever Java is adopting and reaping the benefits of functional programming. This is not to say that Java is moving to a new paradigm, but only adopting the best of both the worlds.
What are Method references?
Method reference is used to refer method of functional interface. Now what is a functional interface, you may ask. A functional interface is an interface that contains only one abstract method.
There are lot of benefits with Method references. In fact this is one of the most awaited features by Java community of developers. You will know more about Lambda expressions and method references and more in this course.
A a high level, you will know all of these with this course.
– Java Lambda expressions
– Method references
– Functional interface
– Anonymous inner class
– Examples of Java Lambdas and method references
– Use cases of Lambdas
– Constructor references
– Default Methods
– Functions package
Content