Hi Everyone, welcome come back with the tutorial. In this tutorial
we'll talk about, What is Lambda? and its syntax and usages of lambda.
Basically we are going to discuss the theory part of Lambda in this tutorial. Lambda or lambda expression
is equivalent to a function without a name.
We can also call lambda as an anonymous function.
It has all the qualities that a regular method has such as method parameters , method body and return type.
A lambda in Java is similar to a method without a name as it was mentioned.
and it is also not tied to any class. Lambda expression can also be assigned to a variable and passed like
any other variable in Java.
Let's take a look at the syntax of the lambda expression. Syntax starts with open braces through which the
input parameters can be passed to the lambda. Followed by that we have an arrow which separates the input
from the method body. Lambda body is provided within the curly braces.
Body is the one which is going to hold the actual content.
what that lambda is going to do with the input parameters.
We'll look into the different examples of implementing lambda in the upcoming tutorials.
Let's take a look at the usages of lambda. Lambda's main purpose is to implement the functional interfaces.
Functional interfaces are otherwise called as SAM which stands for Single Abstract Method interfaces.
Don't worry if the term Functional Interfaces is really new to you.
We will discuss more in detail about the Functional Interfaces as a separate section in this course.
For now you just need to know if an interface has just one abstract method then those interfaces are
categorized as functional interfaces.
All those Single Abstract Method interfaces are annotated with @FunctionalInterface annotation.
Some of the existing functional interfaces prior to Java 8 are Runnable and Comparator.
Let's implement the Comparator and Runnable interfaces using Lambda in the next tutorial. With this we came
to the end of this tutorial.
Thank you for watching.