#73 Lambda Expression in Java

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • Check out our courses:
    Java Full Stack and Spring AI - go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    DevOps with AWS: From Basics to Mastery : go.telusko.com...
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : go.telusko.com...
    Coupon: TELUSKO20 (20% Discount)
    For More Queries WhatsApp or Call on : +919008963671
    Udemy Courses:
    Spring: go.telusko.com...
    Java:- go.telusko.com...
    Java Spring:- go.telusko.com...
    Java For Programmers:- go.telusko.com...
    Python : go.telusko.com...
    Git : go.telusko.com...
    Docker : go.telusko.com...
    website : courses.telusk...
    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();
    obj.show();
    //another way to implement functional interface
    A obj1 = new A(){
    @Override
    public void show(){
    System.out.println("Hello");
    }
    };
    obj1.show();
    //now we can use a lambda expression to implement the functional interface
    //you can remove new A() and public void show() and replace it with () -grater then System.out.println("Hello");
    //if you have single statements you need not mention curly braces and return keyword
    A obj2 = () - grater then System.out.println("Hello");
    obj2.show();
    //here you can use lambda expression to implement interface C
    C obj3= i-grater then System.out.println(i);
    obj3.show(5);
    }
    }
    //one way to implement functional interface
    class B implements A{
    @Override
    public void show(){
    System.out.println("Hello");
    }
    }
    //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);
    }
    Github repo : github.com/nav...
    Java:- bit.ly/JavaUde...
    Spring:- bit.ly/SpringU...
    More Learning :
    Java :- bit.ly/3x6rr0N
    Python :- bit.ly/3GRc7JX
    Django :- bit.ly/3MmoJK6
    JavaScript :- bit.ly/3tiAlHo
    Node JS :- bit.ly/3GT4liq
    Rest Api :-bit.ly/3MjhZwt
    Servlet :- bit.ly/3Q7eA7k
    Spring Framework :- bit.ly/3xi7buh
    Design Patterns in Java :- bit.ly/3MocXiq
    Docker :- bit.ly/3xjWzLA
    Blockchain Tutorial :- bit.ly/3NSbOkc
    Corda Tutorial:- bit.ly/3thbUKa
    Hyperledger Fabric :- bit.ly/38RZCRB
    NoSQL Tutorial :- bit.ly/3aJpRuc
    Mysql Tutorial :- bit.ly/3thpr4L
    Data Structures using Java :- bit.ly/3MuJa7S
    Git Tutorial :- bit.ly/3NXyCPu
    Donation:
    PayPal Id : navinreddy20
    www.telusko.com

КОМЕНТАРІ • 40

  • @옥자-p5r
    @옥자-p5r Рік тому +30

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

  • @addytechie6948
    @addytechie6948 Рік тому +8

    [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.

  • @akej2463
    @akej2463 2 роки тому +9

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

  • @StudyStuff-pk7gv
    @StudyStuff-pk7gv Рік тому +4

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

  • @vengateshan7800
    @vengateshan7800 11 місяців тому

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

  • @NiveditaUmasankar
    @NiveditaUmasankar 11 місяців тому

    Thank you for simplifying Lambda. One of the clearest explanations

  • @SahabasKhan
    @SahabasKhan 8 місяців тому

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

  • @yousufbaig821
    @yousufbaig821 Рік тому +1

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

  • @alexandrumuhulica6665
    @alexandrumuhulica6665 Рік тому

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

  • @veenabakare9100
    @veenabakare9100 7 місяців тому

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

  • @ShanSiraj
    @ShanSiraj Рік тому +1

    excellent simplification, Thanks

  • @ravan_hajiyev
    @ravan_hajiyev 11 місяців тому

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

  • @Aminerami5749
    @Aminerami5749 4 місяці тому

    This lambda thing is amazing. thank you

  • @amanchopra5431
    @amanchopra5431 6 місяців тому

    One of the best video 😊

  • @ganithpeiris3960
    @ganithpeiris3960 Місяць тому

    nice explanation.thanks

  • @puruagni1927
    @puruagni1927 Рік тому +1

    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!

  • @lesterjayabiad3347
    @lesterjayabiad3347 Рік тому

    thanks for sharing free knowledge sir.

  • @ritiktrivedi8780
    @ritiktrivedi8780 7 місяців тому

    Amazing 🎉

  • @youssefoubrik5254
    @youssefoubrik5254 6 місяців тому

    Thank you sir

  • @ajayghode3602
    @ajayghode3602 Місяць тому

    Thank You. Awesome!

  • @rutukeshparmaj2068
    @rutukeshparmaj2068 11 місяців тому

    Thank You❤

  • @ukaszkiepas57
    @ukaszkiepas57 Рік тому

    thank you mate !!!!

  • @ravan_hajiyev
    @ravan_hajiyev 11 місяців тому +1

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

  • @movietrailer3616
    @movietrailer3616 Рік тому +1

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

  • @poojasuryavanshi6005
    @poojasuryavanshi6005 2 місяці тому

    Hello,In your previous videos of interface you said that we can't instantiate the interface or create the object but here how you created the object of an interface A here? Can you please explain me

  • @yousufbaig821
    @yousufbaig821 Рік тому +14

    Achieving python using Java 🤣😂

  • @sitharainfotechnologies304
    @sitharainfotechnologies304 Рік тому +1

    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

    • @sife1808
      @sife1808 Рік тому +1

      @@harizahmad100 Only one abstract method to be precise. It may or may not have default methods.

    • @koyacrab
      @koyacrab Рік тому

      its an annotation, watch the vid right before this one in the playlist

  • @jyotiradityatripathi6095
    @jyotiradityatripathi6095 9 місяців тому

  • @AK-tt7fc
    @AK-tt7fc 9 місяців тому

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

  • @adanskiesabaria
    @adanskiesabaria Рік тому

    how to chat arrow like that ?

  • @samartajshaikh2601
    @samartajshaikh2601 Рік тому

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

  • @Moinshaikh611
    @Moinshaikh611 Рік тому +1

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

  • @CLASH.FIRE777
    @CLASH.FIRE777 Місяць тому

    Tomorrow is exam 😅😅

  • @inoxide5454
    @inoxide5454 17 днів тому +1

    ARE YOU REDDY FOR LAMBDAS..? 🐑

  • @Kings238
    @Kings238 10 місяців тому

    ho pretty