#73 Lambda Expression in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture, we are discussing lambda expression:
#1 what is lambda expression in java?
-- In Java, a lambda expression is a concise way to implement a functional interface.
A functional interface is an interface that has only one abstract method, and it can be implemented using a lambda expression.
-- In the previous lecture we see that we are making a class or inner class to implement the functional interface
but using lambda expression we do not need of new class and inner class to implement.

#2 Properties of the lambda expression
Concise syntax: Lambda expressions provide a concise and expressive syntax for defining functional interfaces.
They allow you to define the behaviour of a functional interface in a single line of code.

Functional programming: Lambda expressions are a key component of functional programming in Java.
They allow you to write code that is more declarative and expressive, and less verbose than traditional imperative code.

No need for anonymous inner classes: Lambda expressions provide an alternative to anonymous inner classes, which are often
used to implement functional interfaces in Java. Lambda expressions are more concise and easier to read than anonymous inner classes.

#3 example:

class Main{
public static void main(String []args){
A obj = new B();

//another way to implement functional interface
A obj1 = new A(){
@Override
public void show(){
}
};

//now we can use a lambda expression to implement the functional interface
//if you have single statements you need not mention curly braces and return keyword

//here you can use lambda expression to implement interface C

}
}
//one way to implement functional interface
class B implements A{
@Override
public void show(){
}
}

//specify it is functional interface
@FunctionalInterface //we use this annotation to specify it is functional interface
interface A{
void show();
//void run(); //this will give error as it is not functional interface
}

interface C{
public void show(int i);
}

More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

I cannot believe this amazing lecture is just for FREE... thank you, sir. You made the world smarter!

zxsodob
Автор

you make this complex thing look so simple..huge respect for you

StudyStuff-pkgv
Автор

1:25 Gave me a much better look at lambas, cool video

akej
Автор

[00:00] Lambda expressions in Java simplify instantiation of functional interfaces.
[01:37] The arrow in Lambda expressions replaces the need for writing the entire method body.
[02:31]Lambda expressions are syntactic sugar, reducing code by simplifying the instantiation of functional interfaces.
[03:56]Lambda expressions can handle parameters, and you can skip mentioning the variable type and use shorthand syntax.
[05:45]) Lambda expressions save on file creation, reducing the number of generated class files.

addytechie
Автор

So simple and compact, finally I understood this! Thank you

alexandrumuhulica
Автор

Sir..amazing lecture it is. u just made it easier to understand it Sir. Thanks you so much for these videos

veenabakare
Автор

Thank you for simplifying Lambda. One of the clearest explanations

NiveditaUmasankar
Автор

thanks for sharing free knowledge sir.

lesterjayabiad
Автор

Sir, your way of explanation is awesome and quickly understandable. Please keep post more videos 👍

vengateshan
Автор

others make it much difficult bt you are explaining very simple and understandable, thanks sir 🥰

jfyvxvw
Автор

thanks for the explanation teacher by the way ) good and smooth with your humorious speaking
)

revan_hajiyev
Автор

hi bro
on above if Interface you mentioned
FunctionalInterface right
that is why bro?

can you please help me to understand that

Thanks
C Ashoka

sitharainfotechnologies
Автор

Where is the complete Playlist of this series I can't find

movietrailer
Автор

Beautifully explained !!

Next time I visit Hyderabad I wanna host you a biryani treat :)

yousufbaig
Автор

Hi, here we dont need implements keyword . kindly any one clarify on this .

AK-ttfc
Автор

I liked the lecture, but when you said shorter code syntactical sugar I couldn't help myself from laughing being a python programmer 😂😂. But then again, great lecture!

puruagni
Автор

lol: Java says: hey, don't worry i am there )))

revan_hajiyev
Автор

I came from javascript background
It's similar to arrow function 😅

Moinshaikh
Автор

again a cliffhanger at the end. This is good though, you are keeping every video limited to one crucial lesson.

samartajshaikh