Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Java Lambda and Method References!
Rating: 4.5 out of 5(28 ratings)
2,121 students

Java Lambda and Method References!

Learn Java 8 Lambda Expressions and Method References
Last updated 12/2022
English

What you'll learn

  • Lambda Expressions
  • Method References
  • Functional Programming in Java
  • Default Methods

Course content

1 section7 lectures46m total length
  • Life Before Lambdas6:03

    Learn how to send a block of code as an argument by creating a small interface and an anonymous class, laying the groundwork for lambda expressions and method references.

  • Lambda Expressions6:44

    Learn how to convert anonymous classes to lambda expressions in Java, explore type inference, and see how lambdas improve readability and align with functional programming shifts.

  • Lambda Examples5:58

    Explore converting Java methods to lambda expressions, including single-line and multi-line forms, type inference, return statements, and the role of functional interfaces and the functional interface annotation.

  • Method and constructor References12:36

    Learn how method references replace single-line lambda expressions by calling static or instance methods, and explore constructor references for concise, readable code.

  • Function Package6:32

    Learn how to replace custom interfaces with Java 8's predefined functional interfaces from java.util.function, using Function, Consumer, and BiFunction with lambda expressions and apply methods, for cleaner code.

  • Lambda Theory3:55

    Clarify the difference between anonymous classes and lambda expressions. Explain that lambdas are compiled differently and avoid extra dollar class files, encouraging a functional programming mindset.

  • Default Method4:43

Requirements

  • Basics of Java

Description

Java Lambda expressions (or simply Java Lambdas) and method references are one of the major features of Java and also one of the most confusing topics in Java. In this course, we will briefly understand and experiment with Java 8 lambda expressions and method references with great examples.

The goal of this course is to get you comfortable with Lambda expressions and method references so you can answer interview questions or participate in coding interviews.

This course assumes that you know the basics of Java programming and that you can write and run Java programs.

What are Lambda expressions in Java?

Introduced in Java 8, a lambda expression is a short block of code (It looks more like an expression than a chunk of code block), which takes in parameters and returns a value. Unlike Methods, Lambda expressions do not need a name and they can be implemented right in the body of a method.

This will not only improve the code readability, but this is the first time ever Java is adopting and reaping the benefits of functional programming. This is not to say that Java is moving to a new paradigm, but only adopting the best of both the worlds.

What are Method references?

Method reference is used to refer method of functional interface. Now what is a functional interface, you may ask. A functional interface is an interface that contains only one abstract method.

There are lot of benefits with Method references. In fact this is one of the most awaited features by Java community of developers. You will know more about Lambda expressions and method references and more in this course.

A a high level, you will know all of these with this course.

- Java Lambda expressions

- Method references

- Functional interface

- Anonymous inner class

- Examples of Java Lambdas and method references

- Use cases of Lambdas
- Constructor references

- Default Methods

- Functions package

Who this course is for:

  • IT Professionals
  • IT Managers