Lambda Expressions in Java - Full Simple Tutorial

  Рет қаралды 711,439

Coding with John

Coding with John

2 жыл бұрын

Full tutorial for Lamba expressions in Java.
Complete Java course: codingwithjohn.thinkific.com/...
Lambdas in Java can be very confusing and hard to understand for a beginner Java learner, but they don't have to be. Lambda expressions allow you to create a method implementation as an object, and you can learn how in this tutorial.
Lambdas were introduced in Java 8, and are one of the coolest things in the Java language. By the end of this video, you'll know all about how Lambdas work, and how and when you can use them.
Learn or improve your Java by watching it being coded live!
Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
Let me know what else you'd like to see!
Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
📕 THE best book to learn Java, Effective Java by Joshua Bloch
amzn.to/36AfdUu
📕 One of my favorite programming books, Clean Code by Robert Martin
amzn.to/3GTPVhf
🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
www.audibletrial.com/johnclean...
🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
bit.ly/3QPNGko
📹Phone I use for recording:
amzn.to/3HepYJu
🎙️Microphone I use (classy, I know):
amzn.to/3AYGdbz
Donate with PayPal (Thank you so much!)
www.paypal.com/donate/?hosted...
☕Complete Java course:
codingwithjohn.thinkific.com/...
codingwithjohn.com

Пікірлер: 601
@CodingWithJohn
@CodingWithJohn 2 жыл бұрын
One additional note - although lambdas do only work in the context of a functional interface, you don't necessarily need to always create your own in order to use one. There are many that are built into Java, and they cover most uses cases you'll see: docs.oracle.com/javase/8/docs/api/java/util/function/package-summary.html
@rokitap.w1193
@rokitap.w1193 2 жыл бұрын
I swear John you must be going to my university with me or something this is the exact thing I needed thank you!
@libertymedicalcommunicatio4908
@libertymedicalcommunicatio4908 2 жыл бұрын
Thanks for this
@Hufsa
@Hufsa 2 жыл бұрын
Great, I was looking for this, thank you!
@yasseromari1074
@yasseromari1074 2 жыл бұрын
Good job , thank you for that !! Also I would love to see you making a video about streams and how we can associate the use of it with lambdas. Regards 👍🏻
@babythedude
@babythedude 2 жыл бұрын
Please do Java Reflection, if there is a person who can do it well, it would be you
@danielcommins1285
@danielcommins1285 2 жыл бұрын
The key point here like you say is lambdas allow method definitions to be used as variables/objects. Many other languages allow for function names to be passed as variables for callbacks and whatnot and Java never had a clean way to do that until lambdas. Only thing I would add to this is that putting the parameter type in the lambda expression is allowed and makes it easier to understand that the lambda is a method definition: (String p, String s) -> //code
@stepbystepcoding4113
@stepbystepcoding4113 2 жыл бұрын
thanks, bc i was wondering what was the point of all this, it didn't look like a step forward at first, it looked like a step backwards
@enfieldli9296
@enfieldli9296 Жыл бұрын
It works like JS callback/anonymous function. The method definition: (String p, String s) -> {}; is indeed a caveat
@christianbarnay2499
@christianbarnay2499 4 ай бұрын
Reflection allows that. And it exists since the very first versions of Java. It even does more than that. It allows you to break scope limitations and call a private/protected/package method from places that are not supposed to see the method. I used reflection once in my entire career. It was in java 1.2. And it was to access a method in a library that was erroneously declared as private by its author. At that time I didn't have access to a decompiler. Of course when I have a similar situation now, I simply decompile the class to create an override in my source code.
@feynthefallen
@feynthefallen 4 ай бұрын
I wouldn't call that a clean way of doing it. You have to essentially create a type (functional interface) to which you then can dynamically assign an ad hoc implementation. In my mind, that's just a stupid way of doing it, compared to C or Javascript. What I would have done would be to introduce a parametrized type Function, that lets you create the declaration on the fly, like so: Function fancySquare = (String s, Number n) -> s + (n*n)
@danielcommins1285
@danielcommins1285 3 ай бұрын
​@@feynthefallencan't you just create that parameterized type yourself? The current implementation gives more flexibility.
@felipe2637
@felipe2637 2 жыл бұрын
I am always impressed by how good you are at making yourself understandable, your explanations are all clear and meaningful. It's definitely a privilege being able to access such a high quality content for free.
@gatescob
@gatescob Жыл бұрын
Yes
@ntigirishari
@ntigirishari Жыл бұрын
Oh yeah!!!😀
@andersonabe5044
@andersonabe5044 2 жыл бұрын
Hi, John, I'm not a quick learner, but I work hard. English is not my native language, and I watch and rewatch your videos a couple of times - and I can say: if you keep doing this amazing videos, I might learn some java. I'm reading a java handbook right now, but next, I'll take your course.
@fabiorachid3430
@fabiorachid3430 2 жыл бұрын
Head First Java book can be really helpful to you, it's really clear and easy to understand. It has translations to many languages too. You probably can find a PDF online. Use it as a complement to John's videos. Good luck!
@emmanuelnsiah8036
@emmanuelnsiah8036 8 ай бұрын
You should start right now too
@carlellis9647
@carlellis9647 2 жыл бұрын
I've been doing Java based web application development for over 20 years. I often like to take refresher courses on things I've studied before. This is easily the best explanation with practical examples I've seen for Java Lambas. The concepts are clearly explained. Thanks John for making such a great video!
@djk1288
@djk1288 Жыл бұрын
My biggest "a-ha" moment here was when you showed how we go from public void print() {} to just () -> {}. Super intuitive, very good work!
@alexj1580
@alexj1580 2 жыл бұрын
When I first started coding, I have used Java and these videos have been a great refresher on the smaller and intricate things that Java has to offer. Great videos! Already learned so many things.
@sourabh7434
@sourabh7434 2 жыл бұрын
Please don't ever stop uploading. These videos help me in my academics and coding in general a lot. Thank You.
@GuilhermePalazzoRodrigues
@GuilhermePalazzoRodrigues 2 жыл бұрын
This course is a gem, concise, clear and thorough, thank you!
@MaryamMaqdisi
@MaryamMaqdisi 2 жыл бұрын
I've been using lambda for a while but it's the first time I understand how it works behind the scenes, thanks a lot for this video!
@ahmadhafian3785
@ahmadhafian3785 2 жыл бұрын
I am currently studying computer sience and been literally devouring all of your videos, they have so much information, are easy to understand and have a good structure. Thank you.
@robertzaryal3416
@robertzaryal3416 Жыл бұрын
I found Lambda Expression is the exact same Arrow Function in JavaScript. I think it's usable in terms of functional programming but don't know whether there is a need of it in object oriented language like Java! Thumbs up for you, indeed you are a great teacher.
@raz0229
@raz0229 2 жыл бұрын
Java receives a lot of backlash from inexperienced and experienced developers of being too old school, bloated and lacking modern features and syntax, although.. ever since I have started watching your videos, I've seen a major improvement and they are really trying to keep things up to date as of lambda expressions which provide more of a functional approach towards problems. Turns out you just need a teacher like John to really appreciate and understand it. :)
@Quinteger
@Quinteger 2 жыл бұрын
Also this feature has existed for a long time, version 8 where it was introduced came out in 2014. Since then they greatly accelerated their version bump speed, currently we are at version 17 with a lot of new features like local type-inferred vars, switch lambdas, data records and so on.
@curtisdevine2953
@curtisdevine2953 11 ай бұрын
This was an excellent video! I have struggled to understand lambdas for a while and you just connected all the pieces that reading documentation and running examples cannot. Thank you!
@prathap2712
@prathap2712 Жыл бұрын
I had to watch dozens of videos to understand lambda expressions. Finally i found the right one. Thanks a ton 🙏
@tarifhalabi
@tarifhalabi 2 жыл бұрын
Clear, concise and to the point. Nice video John.
@pedroalbertogomes3809
@pedroalbertogomes3809 2 жыл бұрын
I discovered this channel today and already watched about 7 videos. Amazing! Thanks
@hyrumtanner5584
@hyrumtanner5584 Жыл бұрын
I appreciate how your videos get straight to the point. I tried watching a video from another channel about a Java topic and at least half of the video could have been edited out with no loss of meaningful information.
@simongraham2516
@simongraham2516 Жыл бұрын
Never came across a more clearer explanation!
@jilliansechrest5906
@jilliansechrest5906 2 жыл бұрын
You are a phenomenal instructor - you saved my behind in data structures and algorithms and this was a great refresher on lambdas.
@pattyboi55
@pattyboi55 2 жыл бұрын
I have been watching your videos for a while and I have to say you are an excellent resource. You explain in such an intuitive way. Now when I don't understand a concept, I check if you have done a video on it first. Thanks for all you do!
@mythilikalidasan
@mythilikalidasan 2 жыл бұрын
Most wanted tutorial from you!!! Thanks :)
@dangnguyen.92
@dangnguyen.92 2 жыл бұрын
I have never seen anyone who can explain lambas expression as good as your. You help a lot for ppl who doesnt lambas.
@pinolskun8764
@pinolskun8764 2 жыл бұрын
This is better then other courses you have to pay a premium for, your explanations are so evidently thought out in a clear to understand manner for the listener and that's absolutely beautiful. Thank you :)
@EricKolotyluk
@EricKolotyluk 2 жыл бұрын
I have been using lambdas for many years, first with Scala, then with Java, and watching your video, I am amazed how much I learned. Kudos to you for creating such as useful lesson...
@chrisbrownbridge5885
@chrisbrownbridge5885 2 жыл бұрын
First video I've watched of yours and I am beyond impressed! You explain things so perfect and clear which allowed me to understand it all so much easier! Definitely watching the rest of your vids! Amazing teacher!
@AmanRaj-dh2ru
@AmanRaj-dh2ru Ай бұрын
one of the best, succinct yet comprehensive overviews of lambdas in java that i've ever come across! thanks a lot
@lemonghost5591
@lemonghost5591 Жыл бұрын
Absoultly clear and concise! Thanks alot!
@FukSN
@FukSN 2 жыл бұрын
Thanks John. Clear and simple to follow as always 👍
@assur7477
@assur7477 Күн бұрын
You are doing by far the best Explanations for Java and figuring out how to use all the Tools the Language gives you. Currently, struggling mighty with my Coding Exam in a couple of days, but you are saving my ass, so a Huge Thank You!
@aardappel3693
@aardappel3693 2 жыл бұрын
Normally I love your explanations. But today I got very confused.
@forreal_bhenchod
@forreal_bhenchod 22 күн бұрын
@@chrisstucker1813 thanks
@gingersoda2524
@gingersoda2524 19 күн бұрын
Me too
@KhaledAhmed-cs8rv
@KhaledAhmed-cs8rv 15 күн бұрын
His naming of the functions was way off. Print printable print thing.....
@bullshitul
@bullshitul 13 күн бұрын
The thing with the printable thing is that you should only try to print something, a thing - object, that has a print method. Thus a printable thing. Printable is the class Thing is the object
@chinmayrath8494
@chinmayrath8494 2 жыл бұрын
Clear, concise, to the point, thanks a lot !! Helped a lot
@elairyx
@elairyx 2 жыл бұрын
Oh yes, thank you so much for this video! I looked at many articles before etc. but couldn't really grip the entire thing or couldn't remember how to use them - now I can :)
@alantran2133
@alantran2133 Жыл бұрын
Your videos are always so helpful for the Java beginner like me. Thanks John! Hope you always keep your good work.
@shounaksengupta2154
@shounaksengupta2154 2 жыл бұрын
in awe of the quality.
@zipkitty
@zipkitty Жыл бұрын
You did in 5 minutes what my Uni prof. couldn't in two lectures. That goes to show how much people who actually use java professionally have a deeper understanding of java.
@danteUp
@danteUp 2 ай бұрын
Amazing video. Clear and precise. Thanks for that
@mohsenrezaee9936
@mohsenrezaee9936 Жыл бұрын
You say it so simply that I don't understand why I didn't understand it before watching this! Thanks!
@juanestebanparraparra8531
@juanestebanparraparra8531 3 күн бұрын
I must say you are one of the greatest coding teachers I have ever seen! Thanks John!
@yahligilboa7489
@yahligilboa7489 Жыл бұрын
i love your explanations! they are as clear as they get. great videos!
@kostiantynkarzhanov9216
@kostiantynkarzhanov9216 4 ай бұрын
Thank you! Awesome tutorial! 💛
@nikolaosk2169
@nikolaosk2169 Жыл бұрын
Just thank you!!!!! Great work!!!!
@micleh
@micleh 2 жыл бұрын
Awesome. You succeed in summarizing the entire topic of the video in 30 seconds at the end, starting from 12:15. I learned a lot. I've never looked behind the scenes of lambdas so far, but just accepted the shortcuts they provide. I have no idea whether method references are worth tackling as well, but if they are, I'd very much enjoy a video on them. I've been looking forward to a new video since your last video, and this one has been totally worth waiting for. Thanks so much!
@slhx8956
@slhx8956 Жыл бұрын
I am in my last semester as a cs major. You explain these concepts so well; maybe even better than my professors, and they are all really smart people!
@clarkeisackson4747
@clarkeisackson4747 Жыл бұрын
Fantastic lesson. Thank you.
@adamsimon8943
@adamsimon8943 Жыл бұрын
I'v been searching all day... and finally a great explanation! Thank you.
@ninagutovska8653
@ninagutovska8653 5 ай бұрын
Thanks, very clear explanation.
@bmwsupreme5908
@bmwsupreme5908 7 ай бұрын
Awesome explanation, many thanks!
@user-in4qj9vy9k
@user-in4qj9vy9k Жыл бұрын
The best explanation of lambdas! Thank you so much🙏
@hmzza1
@hmzza1 Жыл бұрын
With more than 20 years experience in Java programming, you really explain advanced topics so simple!!
@KMJMusic
@KMJMusic 2 жыл бұрын
Wow, i've never understand lambdas that well, but rn, i am happy that i can make my code workflow easier, and shorter! thank you for your great tutorial
@ShinMugenNoKabe
@ShinMugenNoKabe 2 жыл бұрын
Great video as always Mr John, lambdas been a pain in the ass for a junior developer like for long long time and I do gotta say that I'm addicted to your videos as I learned better than in my school
@sebon11
@sebon11 Жыл бұрын
Amazing tutorial, thx!
@sebastianrad7074
@sebastianrad7074 2 жыл бұрын
Thanks for explaining!
@Devivl
@Devivl Жыл бұрын
Very interesting. Thank you, John!
@ourytubeful
@ourytubeful Жыл бұрын
The most 'simplistic' explanation of lambda i've ever seeen !!! 👍👍👍
@ashuiet
@ashuiet 2 жыл бұрын
Very clean explanation !! Thanks @Coding With John.
@Madhusudhan74
@Madhusudhan74 2 жыл бұрын
Very clearly explained.
@MGtvMusic
@MGtvMusic Жыл бұрын
This channel is a goldmine
@JustinBieberFanSA
@JustinBieberFanSA Жыл бұрын
This is a great explanation of Lambdas. Thank you, I have been a java dev for the last 9 years, I have never used functional interfaces or lambdas in a professional setting but I am getting ready for my OCA certification and this is an amazing explanation. This is the first time that someone has explained it in a way that made sense to me. I am most definitely going subbing to the channel.
@ziqimage
@ziqimage Жыл бұрын
The quality of this channel, no word.
@twisterwiper
@twisterwiper Жыл бұрын
Wow. This is the best explanation of lambdas I have come across. How you trim the expression in the beginning, removing access modifiers and so on is really great. Thank you!
@burgerbob7324
@burgerbob7324 Жыл бұрын
That was extremely helpful in understanding what the heck is going on with the lambda syntax. I've seen them before but immediately understand it better after seeing him do that.
@omkardeshpande9640
@omkardeshpande9640 2 жыл бұрын
John hats off to your simplicity explanation. You have excellent command in your communication. 👏
@ibozic1
@ibozic1 2 жыл бұрын
Your tutorials are great, they cut straight to the point and are very understandable. Keep up the good work 👍
@KRaJWanders
@KRaJWanders 17 күн бұрын
one of the best videos on Lamda Short and to the point Thanks @CodingWithJohn
@svetlanamazhaykina6918
@svetlanamazhaykina6918 4 ай бұрын
Thanks for your work, John! Well done!
@yuriytheone
@yuriytheone Жыл бұрын
Thanks! Best exlanation of lambda funvtions.
@aidoka2000
@aidoka2000 2 жыл бұрын
excellent explanation of Java. Thanks John for the amazing tutorials.
@puquest
@puquest 2 жыл бұрын
Amazing job and clean, step by step you complete the course! amazing
@edup2306
@edup2306 2 жыл бұрын
That is the best explanation that I have seem so far. Thank you!
@HerrBieber
@HerrBieber 2 жыл бұрын
Finally I understood it. Thanks dude
@rahimeyldz2272
@rahimeyldz2272 2 жыл бұрын
Awesome video, thanks a lot John
@rlasc84
@rlasc84 2 жыл бұрын
Hi John. Your videos are making me consider use java again in my projects
@shankar7435
@shankar7435 Жыл бұрын
Excellent explanation on Lamdas.
@AlexRubyTV
@AlexRubyTV 2 жыл бұрын
Thank you so much for the explanation! This is the best video on lambda topic that I ever seen. It is very clear and straightforward.
@joswinprince9474
@joswinprince9474 2 жыл бұрын
Good man....explained with confidence and clear
@Sam-pq2pk
@Sam-pq2pk Жыл бұрын
that was a beautiful explanation man, thanks!
@kiraalberiti7609
@kiraalberiti7609 8 ай бұрын
The best explanation i heard until now
@tusharm.8161
@tusharm.8161 2 жыл бұрын
You are a great teacher.
@lyn8964
@lyn8964 2 жыл бұрын
thank you , great videos!
@amirkamalian4848
@amirkamalian4848 2 жыл бұрын
Thank you ALOT ! you are an inspiration
@ReBufff
@ReBufff 2 жыл бұрын
This guy is on fire, every single video he posts is interesting and informative. I wonder how long he can keep this up!
@boldschool6308
@boldschool6308 Жыл бұрын
Simple and effective thanks alottt
@vasukolluri1425
@vasukolluri1425 Жыл бұрын
Good one, very much clear
@benjaminrickel
@benjaminrickel 2 жыл бұрын
This is a great video, thank you for explaining lambdas in a clear and concise way.
@alexandre9051
@alexandre9051 2 жыл бұрын
Thanks John ... very easy to understand your explanations! Cheers
@SuperAryan2001
@SuperAryan2001 Жыл бұрын
Love the video. Thank you
@jalilhasanli5577
@jalilhasanli5577 2 жыл бұрын
Thanks a lot mate! I knew those things you were talking about. Just watched to see if you explain properly, and I can surely say that it was perfect. I will watch other tutorials you posted to learn even more.
@randydollente9651
@randydollente9651 3 ай бұрын
Thank you, John
@andronikusgametech8902
@andronikusgametech8902 2 жыл бұрын
Awesome tutorial! Love that it was made simple.
@ntigirishari
@ntigirishari Жыл бұрын
I did😀😀 You're really a great instructor!!!
@aminechichi8910
@aminechichi8910 10 ай бұрын
Amazing Video, That was Smooth and clear Thanks a lot
@leeamraa
@leeamraa 2 жыл бұрын
Very cool! Thank you.
@SQ7N
@SQ7N Жыл бұрын
Dear John. Thank you! Awesome
@yuvrajsharma6803
@yuvrajsharma6803 Жыл бұрын
Thank You. Your videos are really helpful for improving the skills
@technics6215
@technics6215 Жыл бұрын
The best lambda explanation ever. Thank you!
@cfpls
@cfpls 2 жыл бұрын
I love how you explain concepts
@houdaejbkl5126
@houdaejbkl5126 Жыл бұрын
John ! I want you to know that you're the coolest Java teacher. I injoyed your courses a lot , so THANK YOU !!
@ivan-Croatian
@ivan-Croatian Жыл бұрын
Amazing explanation. When someone has the ability to explain such abstract example so smoothly that even the absolute begginer could understand it, that means that the person has huge knowledge about that matter. Thanx!
@i_am_reshad
@i_am_reshad Жыл бұрын
I learn something ! thank you !
Generics In Java - Full Simple Tutorial
17:34
Coding with John
Рет қаралды 1 МЛН
Optionals In Java - Simple Tutorial
15:53
Coding with John
Рет қаралды 200 М.
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,5 МЛН
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 2,6 МЛН
The child was abused by the clown#Short #Officer Rabbit #angel
00:55
兔子警官
Рет қаралды 22 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 10 МЛН
Functional Interface | Lambda Expression in Java
13:56
Telusko
Рет қаралды 138 М.
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 325 М.
Java lambda λ
18:00
Bro Code
Рет қаралды 89 М.
Static vs Non-Static Variables and Methods In Java - Full Simple Tutorial
11:29
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 293 М.
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 1,8 МЛН
New Java Version 22 - The 3 Best New Features You'll ACTUALLY Use
13:15
Coding with John
Рет қаралды 95 М.
Software engineer interns on their first day be like...
2:21
Frying Pan
Рет қаралды 13 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,5 МЛН