Тёмный

Lambda Expressions in Java - Full Simple Tutorial 

Coding with John
Подписаться 328 тыс.
Просмотров 682 тыс.
50% 1

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

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

 

6 фев 2022

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 578   
@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 2 месяца назад
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 2 месяца назад
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 2 месяца назад
​@@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 11 месяцев назад
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 6 месяцев назад
You should start right now too
@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!
@carlellis9647
@carlellis9647 Год назад
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!
@sourabh7434
@sourabh7434 2 года назад
Please don't ever stop uploading. These videos help me in my academics and coding in general a lot. Thank You.
@curtisdevine2953
@curtisdevine2953 9 месяцев назад
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!
@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.
@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.
@misaelpereira9679
@misaelpereira9679 2 года назад
Never have seen a so clearly explanation about java lambdas. You rock!
@ohyeahbabyyy603
@ohyeahbabyyy603 2 года назад
I find it amazing how I'm taking an advanced java course in college right now and these videos are literally covering topics we're going over. Just have to say you do an amazing job btw, literally learn more in these 12 minute videos then I do in 2 hour long lectures. 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!
@1234567mrbob
@1234567mrbob 2 года назад
This was a big help! I've been programming in Java for 5 years, but used it like a traditional language and didn't use lambdas. They were always a big mystery to me. When I took a Java skill test there were a lot of lambda questions so that hurt me. This short course explained a lot.
@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!
@GuilhermePalazzoRodrigues
@GuilhermePalazzoRodrigues 2 года назад
This course is a gem, concise, clear and thorough, thank you!
@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.
@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.
@jilliansechrest5906
@jilliansechrest5906 Год назад
You are a phenomenal instructor - you saved my behind in data structures and algorithms and this was a great refresher on lambdas.
@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!
@prathap2712
@prathap2712 10 месяцев назад
I had to watch dozens of videos to understand lambda expressions. Finally i found the right one. Thanks a ton 🙏
@pedroalbertogomes3809
@pedroalbertogomes3809 2 года назад
I discovered this channel today and already watched about 7 videos. Amazing! 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 :)
@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.
@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 :)
@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...
@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!
@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.
@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.
@alantran2133
@alantran2133 Год назад
Your videos are always so helpful for the Java beginner like me. Thanks John! Hope you always keep your good work.
@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
@suwatchainanchai6637
@suwatchainanchai6637 7 месяцев назад
It really feels good when understanding more about how it work when I literally use it everyday especially in java stream. The Best Explaination I can find in YT. Thanks alot
@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!
@oleksandr3275
@oleksandr3275 2 года назад
Thanks to your video, i could understand bascis of lambda. I could catch every info you provided, but couldn't understand from other sources. Thank you so much !
@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.
@AlexRubyTV
@AlexRubyTV Год назад
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.
@mohsenrezaee9936
@mohsenrezaee9936 Год назад
You say it so simply that I don't understand why I didn't understand it before watching this! Thanks!
@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
@hmzza1
@hmzza1 Год назад
With more than 20 years experience in Java programming, you really explain advanced topics so simple!!
@vicke909
@vicke909 2 года назад
I was looking through you channel like 2 days ago to see if you made a tutorial about since i have it in school right now and 2 days later u upload it. THANK YOU :D
@beth8able
@beth8able 2 месяца назад
This tutorial was concise and precise, thank you for such a clear explanation!!!
@tarifhalabi
@tarifhalabi 2 года назад
Clear, concise and to the point. Nice video John.
@simongraham2516
@simongraham2516 Год назад
Never came across a more clearer explanation!
@omkardeshpande9640
@omkardeshpande9640 2 года назад
John hats off to your simplicity explanation. You have excellent command in your communication. 👏
@qwarlock4126
@qwarlock4126 9 месяцев назад
Really nice. I am def enjoying going through your postings! Taking Notes!
@adamsimon8943
@adamsimon8943 Год назад
I'v been searching all day... and finally a great explanation! Thank you.
@FukSN
@FukSN 2 года назад
Thanks John. Clear and simple to follow as always 👍
@user-in4qj9vy9k
@user-in4qj9vy9k Год назад
The best explanation of lambdas! Thank you so much🙏
@ibozic1
@ibozic1 2 года назад
Your tutorials are great, they cut straight to the point and are very understandable. Keep up the good work 👍
@matimozg
@matimozg Год назад
Thanks, man it's very helpful explanation of this topic. I needed help with return type lambda implementation.
@ivanjakovl
@ivanjakovl 10 месяцев назад
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!
@houdaejbkl5126
@houdaejbkl5126 Год назад
John ! I want you to know that you're the coolest Java teacher. I injoyed your courses a lot , so THANK YOU !!
@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.
@dannggg
@dannggg Год назад
couldn't understand from all the stack overflow explantion. drove me nuts. watch you video once and understood. This aitn the first time your videos do this I feel like everytime I watch your videos I only have to watch it once to get the picture lol..thank u john
@rlasc84
@rlasc84 2 года назад
Hi John. Your videos are making me consider use java again in my projects
@patrickfrankdjengoue8734
@patrickfrankdjengoue8734 Год назад
Hi John, Thanks a lot for your commitment, by watching your videos every day I learned so much about Java. one of the best way thad happened to me during my Java learning journey was finding your channel. 😃😃
@phonesj3422
@phonesj3422 Год назад
OMG You are really really really a good teacher!!! I had got stuck of understanding the concept of Lambda for days till watching this video! Thanks a lot!!!
@yahligilboa7489
@yahligilboa7489 Год назад
i love your explanations! they are as clear as they get. great videos!
@svetlanamazhaykina6918
@svetlanamazhaykina6918 2 месяца назад
Thanks for your work, John! Well done!
@yuvrajsharma6803
@yuvrajsharma6803 Год назад
Thank You. Your videos are really helpful for improving the skills
@Preelu
@Preelu Месяц назад
Thank you for this tutorial! Now, I understand lambda in Java.
@HeyThereGuy
@HeyThereGuy Год назад
Listen bro, this is the best explanation of Lambda's I've seen on RU-vid. Great job. I just subscribed.
@chinmayrath8494
@chinmayrath8494 2 года назад
Clear, concise, to the point, thanks a lot !! Helped a lot
@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!
@benjaminrickel
@benjaminrickel 2 года назад
This is a great video, thank you for explaining lambdas in a clear and concise way.
@edup2306
@edup2306 2 года назад
That is the best explanation that I have seem so far. Thank you!
@danteUp
@danteUp 10 дней назад
Amazing video. Clear and precise. Thanks for that
@aminechichi8910
@aminechichi8910 8 месяцев назад
Amazing Video, That was Smooth and clear Thanks a lot
@JohnDoe-ux7hl
@JohnDoe-ux7hl Год назад
Oh thanks, i'm starting with lambda and this video was perfect. You are amazing.
@Jaksteroide
@Jaksteroide 12 дней назад
You explained so well, to this time I was not able to understand anything related to lambdas and functional interfaces, but your video opened my eyes! new Subscriber and will check all of your courses right now!
@technics6215
@technics6215 Год назад
The best lambda explanation ever. Thank you!
@ourytubeful
@ourytubeful Год назад
The most 'simplistic' explanation of lambda i've ever seeen !!! 👍👍👍
@moyolinux
@moyolinux Год назад
not bad quick and insightful, defiantly helps with the lambdas section on headfirst java
@lemonghost5591
@lemonghost5591 Год назад
Absoultly clear and concise! Thanks alot!
@mythilikalidasan
@mythilikalidasan 2 года назад
Most wanted tutorial from you!!! Thanks :)
@porkman1838
@porkman1838 Год назад
Your videos are great, well thoughtout and explained various cases, video is not super long. Code is big on screen which I like and the quality overallis solid. Thank you for the effort of putting up these videos. Also, saying why is it useful on the other vids as well makes it so easy to understand why it even exist and why you should use it. Good job.
@johnsavard6269
@johnsavard6269 Год назад
Great video, easy to understand Java tutorial, not a simple thing to find. You earned my subscription.
@aidoka2000
@aidoka2000 2 года назад
excellent explanation of Java. Thanks John for the amazing tutorials.
@alexandre9051
@alexandre9051 2 года назад
Thanks John ... very easy to understand your explanations! Cheers
@tonydaley3281
@tonydaley3281 2 года назад
I love your videos, they are very well put together and easy for me to understand! Any chance you would be willing to make a intro video on Servlets?
@susanthapathirana9195
@susanthapathirana9195 10 месяцев назад
This simple and best video to understand lambda. Good one John.
@famarakebbeh6966
@famarakebbeh6966 Год назад
Great video explained concisely thanks for the time John you the best
@jaimesastre6393
@jaimesastre6393 2 года назад
very well explained, especially the last part is interesting about the functional interface, reminding only one abstract method.
@ajaya1750
@ajaya1750 Год назад
Wow, amazing! you save my life, explanation is fantastic
@user-iu3fd4is4e
@user-iu3fd4is4e Год назад
my first time is watching your videos, and you got me to subscribe right away because of how good you are. Great explanation
@fernandobondar7105
@fernandobondar7105 18 дней назад
Just blow my mind. Finally can understand the sintax behind the lambda
@khiemdo5527
@khiemdo5527 2 года назад
Waiting for this topic for a long time, and it has been delivered more than enough. Thanks John so much
@ilunghi
@ilunghi 2 года назад
+1, he's totally nailed it once again
@puquest
@puquest Год назад
Amazing job and clean, step by step you complete the course! amazing
@MrBadSmash
@MrBadSmash 7 месяцев назад
Such a great and clear explanation. This might solve a problem I've been trying to solve in a personal project I'm building! There are still some complexities in my code that make it not exactly straightforward, but I think it's a really great start! Without this, I currently have five distinct methods that are near repeats of themselves except for just a couple of lines of code! I'll try it out and see if it can make my code a little less repetitive! Great video, great channel!
@ShubhamSingh-vh1vw
@ShubhamSingh-vh1vw Год назад
This was by far the best explanation for lambda. PERIOD
@dreamtreater
@dreamtreater 4 месяца назад
I have been working through a Java Udemy course, but it wasn't able to explain this subject to me. Watching your video is a relief! Now I understand! It's so much better.
@ashuiet
@ashuiet 2 года назад
Very clean explanation !! Thanks @Coding With John.
@shubhtyagi1
@shubhtyagi1 2 года назад
After watching so many videos, its first time I'm feeling that it's the best explanation 👍
@yuriytheone
@yuriytheone Год назад
Thanks! Best exlanation of lambda funvtions.
@pedroaboffa
@pedroaboffa 2 года назад
Finallyy !! nicee i learned that at the end of my bootcamp !!! thank your for the video!!!!
@babonneau
@babonneau Год назад
I thought that it was going to be a music tutorial from the background in your first seconds of video! Cool to watch a clever Java tutorial from a developer also playing music ;-)
@ziqimage
@ziqimage Год назад
The quality of this channel, no word.
@kostiantynkarzhanov9216
@kostiantynkarzhanov9216 2 месяца назад
Thank you! Awesome tutorial! 💛
@shounaksengupta2154
@shounaksengupta2154 2 года назад
in awe of the quality.
Далее
Generics In Java - Full Simple Tutorial
17:34
Просмотров 998 тыс.
Optionals In Java - Simple Tutorial
15:53
Просмотров 190 тыс.
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37
Mbappé impressionné par le style Konaté 😂🕺
00:12
Functional Interface | Lambda Expression in Java
13:56
Просмотров 130 тыс.
Can you solve this Oxford admissions question?
8:18
Просмотров 55 тыс.
Java lambda λ
18:00
Просмотров 84 тыс.
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37