Тёмный

Lambda Expression in Java 8 

Telusko
Подписаться 2,4 млн
Просмотров 480 тыс.
50% 1

Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-sp...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusk...
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
Discord : / discord
Introduction to Lambda Expression in Java 8.
Java 8 provides remarkable changes in programming. The length of code can be reduce to short using Java 8 features such as 'Lambda Expression'. But how this works?
Java and Spring Framework For beginners with Spring Boot : - bit.ly/3LDMj8D
Java Tutorial for Beginners (2023) :- bit.ly/3yARVbN
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners : goo.gl/p10QfB
Scala Tutorials for Java Developers : goo.gl/8H1aE5
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Socket Programming in Java : goo.gl/jlMEbg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Java Servlet : goo.gl/R5nHp8
Exception Handling in Java : goo.gl/N4NbAW

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 214   
@isbeb507
@isbeb507 5 лет назад
OK, so lambda expressions are a way to implement interfaces without making a new class. Finally I get it. Thanks!
@fatimaadreeta
@fatimaadreeta 3 года назад
I think lambda expressions are more appropriately used as a substitute of one-liner methods. Because we have also used lambda expressionys in abstract classes or inside a container class. And its usually used to express what a method expresses in one line. And that is what I got from the video as well. I may be wrong. 😄
@anonymous-do5bs
@anonymous-do5bs 7 лет назад
thank you very much. just to add, lambda expressions only work with interface implementing only 1 method which is called a functional interface.
@zedzedder1426
@zedzedder1426 5 лет назад
Thanks. I came to the comments to ask exactly about this.
@mrscripp7091
@mrscripp7091 5 лет назад
That question was lingering in the back of my mind for the whole video. Thanks.
@shaistakhalid7761
@shaistakhalid7761 5 лет назад
great help. thanks for this ans.
@gauravshirskar5124
@gauravshirskar5124 4 года назад
@@mrscripp7091 same here
@sumitkawale9878
@sumitkawale9878 3 года назад
@@mrscripp7091 Same bro!
@satyamshah9164
@satyamshah9164 4 года назад
Perfectly explained sir! with the files examples too, showing what happens in the background.
@achrafelkhandouli
@achrafelkhandouli 4 года назад
at first l was like: CAN U JUST GET TO THE POINT! but then it surprised me how that worked out
@hamzahahmad1670
@hamzahahmad1670 5 лет назад
The best explanation of lambda expressions that I've come across. Thank you.
@madhukarreddy5804
@madhukarreddy5804 4 года назад
In just one video I have understood anonymous inner class,boiler plate code, lamda expression. Earlier I have a confusion on these topics. Great explanation Thank you.
@raghuakuthota4900
@raghuakuthota4900 6 лет назад
Wah !.. what an explanation Sir, I became a FAN of you :) I am confusing these lambda expressions from last 1 year. you cleared it in just 10min.. biggest thanks
@mayankmoolchandani7976
@mayankmoolchandani7976 6 лет назад
for(int i=0; i
@hirankeni3871
@hirankeni3871 5 лет назад
// This is better while(true){ System.out.println("THANKYOU SO MUCH SIR "); }
@ahsanashraf7968
@ahsanashraf7968 5 лет назад
() -> sys.out("Thanks");
@mauranisaha
@mauranisaha 7 лет назад
Hi..Its a great VDO.I do have one question.what if we have two undefined function in interface.In that case how we are going to use Lambda expression.Please help me to clear my doubt .Thanks
@danielalt7508
@danielalt7508 6 лет назад
You can only have one method inside a functional interface. if you have more it would not be functional interface and therefore lambda will not be able to be used in this way.
@jeyaprakashchristopher1723
@jeyaprakashchristopher1723 5 лет назад
Add @FunctionalInterface annotation to your Interface to make it as one. It ll restrict us from creating more than one method which is abstract.
@ciphercoderjammer9303
@ciphercoderjammer9303 5 лет назад
Use Default keyword while creating a method in interface and use that with interface reference variable.
@sujithkumar2337
@sujithkumar2337 2 года назад
I have doubt if interface has two different methods then how obj=()-> will identify the correct method
@TECHSOLUTIONSS
@TECHSOLUTIONSS 3 года назад
Okay it's somewhat near to Arrow function
@cokechan1956
@cokechan1956 3 года назад
Perfect explanation, thank you very much. Love your step by step guide from traditional java to java 8 style. Thanks.
@rishnp
@rishnp 2 года назад
Always found lambda confusing , after this video it's crystal clear .. thanks for explaining with example .. really helpful
@sagarmeena0210
@sagarmeena0210 5 лет назад
nice
@balamca416
@balamca416 8 лет назад
Great work,thanks, if interface has more than one method, how java 8 handle in lamba expression. suppose if class implement more than one interface like interface1->show1 and interface1->show2, how we will define in lamda expression
@mak.ak.uk.
@mak.ak.uk. 8 лет назад
"if interface has more than one method" I don't think lambdas can work with an interface with more than one method. Perhaps someone else can confirm.
@ziddy26
@ziddy26 8 лет назад
+MAK AK. You are right. Lambdas can only be used with functional interface.
@misnad
@misnad 4 года назад
Wow, you did a great help. This thing was really hard before watching this video. "One doubt though. Can we use lambda if there are more than one method in the interface?*
@ashishverma-en6kb
@ashishverma-en6kb 6 лет назад
Thanks you sir for all those videos.. Sir all the videos are helpful to know how to work but please tell us when to use with some bigger used case example
@m.praveenkumar3702
@m.praveenkumar3702 6 лет назад
Nice Explanation. 1 doubt what happens if we have multiple methods in the same interface.
@nehagupta1986
@nehagupta1986 3 года назад
same query
@TimBee100
@TimBee100 4 года назад
You don't have to create a class just to implement the interface, you can implement it in the main class. Problem solved!
@MrFxJ
@MrFxJ 6 лет назад
Thank you very much, I wouldn't understand how lambda works until I saw this. Cannot stop thanking you.
@deviraghubabu
@deviraghubabu 3 года назад
how can we implement if we have two methods in Interface like below using lamda expressions interface A{ void show(); void lamdaEx(); }
@sultanb6685
@sultanb6685 7 лет назад
I skimmed through many videos and your video is best by far. GREAT way of explaining and definitely you have great understanding of what you are working with. THANK YOU
@anshabhinandan3560
@anshabhinandan3560 3 месяца назад
You explain good but repeat the same things...which can totally confuse someone
@raghavendrab3087
@raghavendrab3087 4 года назад
U r living GOD. Students/Software Engineers/Jobless shud worship U instead of Unknown Gods.
@jugalprasadsahu5841
@jugalprasadsahu5841 3 года назад
do subscribe to the consumer interface video...haha..it happens...nycly explained
@Gm-wp5ol
@Gm-wp5ol Год назад
Hi telusko what ever you have taught every thing is correct and nice but the way you have explained by commenting , again remove, again comment, again remove people will confuse. Directly tell na this is anonymous inner class this is the syntax then this is lambda expression and this is syntax that's all.
@Aweklin
@Aweklin 4 года назад
Thanks for this great explanation. It settled in my skull 💀.
@jitrulz1
@jitrulz1 4 года назад
Amazing is the only word. demystified Lambda. Thankyou.
@TamilselviR-d6f
@TamilselviR-d6f 3 месяца назад
Very well explained.thankyou.keep posting videos like this
@shubhamtandon3045
@shubhamtandon3045 3 месяца назад
This can’t be explained better than the way you did sir…phenomenal👌
@thelivingcosmos
@thelivingcosmos 4 года назад
In future updates of java:- Why to write code? We don't need this. Just remove the whole code.
@sakshipandey1931
@sakshipandey1931 3 года назад
If lambda doesnt have return type then how compiler knows what is the return type?
@pavankumarkr5667
@pavankumarkr5667 4 года назад
Lambda expressions in Java are like arrow functions in javascript 🤔
@hassanahmed127
@hassanahmed127 2 года назад
you said we cannot make an object of A because it does not have implementation then went on making an object of A?
@psudhakarreddy6548
@psudhakarreddy6548 3 года назад
Good
@chrismartin16cm
@chrismartin16cm 3 года назад
How to handle lambda if you have multiple statements under one method?
@samratsubedi6125
@samratsubedi6125 3 года назад
Lamdas are not replacement of anonymous inner class. You started wrong way.
@waqardetho2426
@waqardetho2426 7 лет назад
this was a great way of explaining.
@esakkisundar
@esakkisundar 3 года назад
What happens when one more method declaration in Interface A? How to handle that case
@reemiessa2392
@reemiessa2392 7 лет назад
You are the best. really ! , you somehow find a way to make everything simple and understandable . i'm going to take the OCA exam next week and lambda expressions was a new topic for me that i need to study for the exam , you really helped making the topic easier for me . Thank you :D !
@31bikashdash
@31bikashdash 8 лет назад
very nice ly explained please put some tutorial over threading and concurrency
@sqb8980
@sqb8980 4 года назад
So basically it works only for functional interfaces?
@gangaraju4030
@gangaraju4030 4 года назад
How to see the generated .class files. Please explain me Sir
@tannerbarcelos6880
@tannerbarcelos6880 4 года назад
Looks like typed JavaScript. So weird lol
@Gorky25
@Gorky25 3 года назад
Why do we need anonymous classes? I never have to use it.
@dhonimsd9506
@dhonimsd9506 2 года назад
How to write lamba when interface has more than 1 method ?
@budhdiprakashsharma1733
@budhdiprakashsharma1733 8 лет назад
interface A{ void show(); } public class AnnonymusClass { public static void main(String[] args) { A obj; obj=new A() { public void show() { System.out.println("Hello JAVA Mr"); } }; obj.show(); } } Sir i have implement this program but it give an error :"Type A is already defind" can you tell me sir because i write same code
@budhdiprakashsharma1733
@budhdiprakashsharma1733 8 лет назад
Ya it is working now but why it is not possible to have same name interface in different file
@himanshuchugh4257
@himanshuchugh4257 5 лет назад
Mind blowing explanation
@abguven
@abguven 3 года назад
Thanks a lot.Very good explanation.
@travelnlearn
@travelnlearn 2 года назад
Thanks for this wonderful video. May gbu with lots of success love and life. Keep Rocking... Small suggestion::Please do add the source code so that later we can use that to revise and make notes please
@TimBee100
@TimBee100 4 года назад
What garbage!! You can remove the { } in the other examples of non-Lambda (8 minute mark). Why are you trying to mislead people by saying that one line of code is equivalent to the other examples with many more lines, including code that is unnecessary? Shameful!!
@seabass6106
@seabass6106 3 года назад
😆 I'm sorry but I had a little giggle about your comment. You didn't saw the video I guess
@TimBee100
@TimBee100 4 года назад
I really don't see any benefit to this. You have to code it anyway and you have to make sure there is a functional interface with the correct signature. What exactly do you gain from just creating a normal method? A few keystrokes?
@04minutes53
@04minutes53 8 лет назад
great work keep it up
@mr_shamanth_m
@mr_shamanth_m 7 лет назад
i have a question here. With lambda expression you are providing implementation for method show() of Interface A in the place where you want to use it (here in main() method). Suppose we implement Interface A in other class, again you need to define implementation for method show() in that new class if you are using lambda expression, so are we not writing duplicate code in every class that implements Interface A when we have same implementation logic ?? If we have a class as XYZ in your example which provides implementation for show() method, then wherever we want to use the implementation of the method show(), we can create object of class XYZ and call the show() method, we need not write implementation logic in this case. Can we get the same support with lambda expression ? without creating a new class XYZ ?
@rishabhsrivastav2842
@rishabhsrivastav2842 5 лет назад
java.awt.EventQueue.invokeLater(() -> { new MainFrame().setVisible(true); }); how to change this expression java with out lambda expression
@shubhamthakur901
@shubhamthakur901 7 лет назад
Sirr in the first example in DemoForEach you commented that part of for loop and for each loop in which u mentioned int i... But how can you use int i after that in for each method () because we did not declare int i after that.....? Please explain me....?
@philomath_u
@philomath_u 2 года назад
excellent explanation from lambda exp to consumer interface.. great.. Thanks Navin
@gowthamisasanapuri9980
@gowthamisasanapuri9980 3 года назад
Thank u very much sir...understood this lamba concept in a very clear way...
@manasviniarul6721
@manasviniarul6721 4 года назад
i have a doubt. In java 8, we can define methods inside interface.Hence no need for a separate class right? In that case how can we call that method?
@tusharseth2539
@tusharseth2539 7 лет назад
Hi great informative video. I have one doubt that obj= new A() will mean that we are creating object of an interface . But how is that possible? as we cant make objects of interfaces right? Can you please explain this thing ? thanks :)
@mechaadi
@mechaadi 7 лет назад
I think new A() is the inner class.
@parthdalvi5855
@parthdalvi5855 7 лет назад
It is an anonymous inner class
@motolola
@motolola 6 лет назад
Not creating Object from interface but simply creating an anonymous inner class to implement the interface while also removing boiler plate code from the inner class.
@mohdaasimansari9489
@mohdaasimansari9489 2 года назад
Amazing, you did the post-mortem of lambda expression, very nice explanation
@jagannathkonjeti7895
@jagannathkonjeti7895 2 года назад
Thanks dear 😘 ❤️ ☺️ 3 love to u
@rajnava944
@rajnava944 2 года назад
Excellent explanation. thank you
@sameerforyou01
@sameerforyou01 4 года назад
Naveen, you should have donation links in summary(description) of all videos..
@positivevibes1769
@positivevibes1769 3 года назад
wow you just play with it....so realistic explanation...Thank you so much..
@aakashgoyal1812
@aakashgoyal1812 4 года назад
Thank You Sir I Have One Query If We have 2 methods then how we will define it??
@parthobhowmick9942
@parthobhowmick9942 5 лет назад
what if there is more than one function in the interface. How to handle different method with ( ) in lambda expression?
@anikettambe8147
@anikettambe8147 7 лет назад
Sir what if i have two different abstract methods with no parameter will then lambda expression work ?
@nupurdeshpande2889
@nupurdeshpande2889 4 года назад
You didn't ask to subscribe or like but I did anyway...really great video
@purushothamgamini9768
@purushothamgamini9768 3 года назад
what about method reusability
@sreerekhamenon1164
@sreerekhamenon1164 3 года назад
Nice content. thanks for the info.
@ashwanikumar4288
@ashwanikumar4288 5 лет назад
Sir you are a genius. Lambda expression was getting on my nerves but now I have a better understanding.
@joshfacts711
@joshfacts711 4 года назад
Hi Naveen, Thanks for the video. It was a nice explanation. Can you please tell me why the implementing methods of an interface through lambda expressions should have the access modifier as "public" only??
@Sameeranborah
@Sameeranborah 4 года назад
If we have more than one method inside interface, then how to write lambda function for each method?
@josephcro2138
@josephcro2138 4 года назад
I was wondering the same thing
@sabihakhan3456
@sabihakhan3456 5 лет назад
Excellent example & explaination
@javascriptwar9525
@javascriptwar9525 5 лет назад
can lamda expression working for more than one interface's methods
@zedzedder1426
@zedzedder1426 5 лет назад
It's a clear explanation with a good example. You sir, should make educational videos about programming, you would do a good job...
@amangautam2658
@amangautam2658 5 лет назад
if we have two methods in interface then how can we access it according to lambda expression
@navanethanmuthusamy
@navanethanmuthusamy 8 лет назад
Hi Can we have one video about FunctioanlInterface? So that we will be bit more clear about it.
@piyalichatterjee6657
@piyalichatterjee6657 4 года назад
Best description in 10 mins Far better , not better far best than the 30 mins videos
@shashidhar71
@shashidhar71 5 лет назад
Dont write so much code like this, only one -> Fasak. 😀
@unemployedcse3514
@unemployedcse3514 3 года назад
Awesome 💞
@JaswiSaharsh
@JaswiSaharsh 2 года назад
Great Explanation Mr.Naveen . Thank you.
@shijibsreji6861
@shijibsreji6861 2 года назад
Thank you so much sir....
@foton8998
@foton8998 2 года назад
Awesome explanation!
@SubhadipBanerjeeSBHDP
@SubhadipBanerjeeSBHDP 4 года назад
Awesome Explanation
@prithikakaliyamoorthy9800
@prithikakaliyamoorthy9800 5 лет назад
Thank you very much... well explained 👍
@deshengli
@deshengli 5 лет назад
Nice explanation! What if the interface has more than one method declared?
@PrinceKumar-jn5zx
@PrinceKumar-jn5zx 5 лет назад
Not good way to explain
@shrutikumari6727
@shrutikumari6727 3 года назад
Thanks Sir,for the proper and the best explanation.
@VijayKumar-rw1xt
@VijayKumar-rw1xt 4 года назад
Hi naveen, Can u make video about lambda meta factory
@YokoYokoOneTwo
@YokoYokoOneTwo 3 года назад
Super understandable even for non english speakers
@gv6980
@gv6980 5 лет назад
Hello Sir Can you please explain how it's possible to have reference of interface and object of class?
@LillEngineered
@LillEngineered 8 лет назад
Very nice and to the point explanation. I don't think any one will unlike it.
@xoda345
@xoda345 5 лет назад
Hey navin, so Lambda expression can be used only with interfaces?
@avishekchatterjee531
@avishekchatterjee531 4 года назад
Now in java 8 we can define a metohd inside an interface....
@kamarony8572
@kamarony8572 6 лет назад
What have you done I can see your code, the way you define is good
@parijatsharma4495
@parijatsharma4495 3 года назад
what will have if I have multiple method in interface
@parijatsharma4495
@parijatsharma4495 3 года назад
what will be the syntax
@contactamartya
@contactamartya 6 лет назад
Its just the best video available in the market! great work.
@varunjohnjohn
@varunjohnjohn 4 года назад
great explanation..
Далее
Consumer Interface in Java 8
9:54
Просмотров 222 тыс.
荧光棒的最佳玩法UP+#short #angel #clown
00:18
11 ming dollarlik uzum
00:43
Просмотров 1,4 млн
DAXSHAT!!! Avaz Oxun sahnada yeg'lab yubordi
10:46
Просмотров 489 тыс.
Functional Interface | Lambda Expression in Java
13:56
Просмотров 151 тыс.
Java 8 Streams API
15:45
Просмотров 154 тыс.
Method Reference in Java 8
21:06
Просмотров 184 тыс.
Lambda Expressions in Java 8 - Full Tutorial
26:32
Просмотров 35 тыс.
Lambda Expressions in Java - Full Simple Tutorial
13:05
Stream API in Java
26:04
Просмотров 331 тыс.
#7 Autowire using Spring Boot
15:16
Просмотров 41 тыс.
荧光棒的最佳玩法UP+#short #angel #clown
00:18