WEBVTT

0
00:00.670 --> 00:03.590
Hi Everyone,  welcome come back with the tutorial. In this    tutorial

1
00:03.600 --> 00:09.350
we'll talk about,  What is Lambda? and its syntax and usages of lambda.

2
00:09.420 --> 00:15.810
Basically we are going to discuss the theory part  of Lambda in this tutorial. Lambda or lambda expression

3
00:15.870 --> 00:18.770
is equivalent to a function without a name.

4
00:18.810 --> 00:23.400
We can also call lambda as an anonymous function.

5
00:23.400 --> 00:30.560
It has all the qualities that a regular method has such as method parameters , method body and return type.

6
00:30.600 --> 00:37.140
A lambda in Java is similar to a method without a name as it was mentioned.

7
00:37.520 --> 00:47.460
and it is also not tied to any class.  Lambda expression can also be assigned to a variable and passed like

8
00:47.490 --> 00:49.750
any other variable in Java.

9
00:50.900 --> 00:58.510
Let's take a look at the syntax of the lambda expression. Syntax starts with open braces through which the

10
00:58.510 --> 01:05.400
input parameters can be passed to the lambda. Followed by that we have an arrow which separates the input

11
01:05.460 --> 01:11.780
from the method body. Lambda body is provided within the curly braces.

12
01:13.250 --> 01:16.460
Body is the one which is going to hold the actual content.

13
01:16.460 --> 01:20.350
what that lambda is going to do with the input parameters.

14
01:21.590 --> 01:27.220
We'll look into the different examples of implementing lambda in the upcoming tutorials.

15
01:27.220 --> 01:35.960
Let's take a look at the usages of lambda. Lambda's main purpose is to implement the functional interfaces.

16
01:36.470 --> 01:43.700
Functional interfaces are otherwise called as SAM which stands for Single Abstract Method interfaces.

17
01:44.090 --> 01:48.770
Don't worry if the term Functional Interfaces is really new to you.

18
01:48.810 --> 01:54.360
We will discuss more in detail about the Functional Interfaces as a separate section in this course.

19
01:54.500 --> 02:01.670
For now you just need to know if an interface has just one abstract method then those interfaces are

20
02:01.670 --> 02:04.910
categorized  as functional interfaces.

21
02:05.450 --> 02:13.070
All those Single Abstract Method interfaces are annotated with @FunctionalInterface annotation.

22
02:13.300 --> 02:19.460
Some of the existing functional interfaces prior to Java 8 are Runnable and Comparator.

23
02:19.720 --> 02:26.440
Let's implement the Comparator and Runnable interfaces using Lambda in the next tutorial. With this we came

24
02:26.440 --> 02:27.900
to the end of this tutorial.

25
02:28.060 --> 02:28.990
Thank you for watching.