Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Functional Programming in Java : Java Lambdas and Streams
Highest Rated
Rating: 4.7 out of 5(113 ratings)
992 students

Functional Programming in Java : Java Lambdas and Streams

Mastering Lambdas and Streams in Java (with lots of code examples)
Last updated 1/2026
English
English [Auto],

What you'll learn

  • Functional Interfaces - what they are and their relationship to lambda expressions.
  • Lambdas - anonymous inner class syntax versus lambda expressions.
  • Functional Interfaces from the API - sample code explaining Predicate/BiPredicate, Consumer/BiConsumer
  • Functional Interfaces from the API - sample code explaining Supplier, Function/BiFunction
  • Functional Interfaces from the API - sample code explaining UnaryOperator, BinaryOperator
  • Method References - their relationship with lambdas. Different types of method references explained with code - bound, unbound, static and constructor.
  • Method References - how the context helps in understanding them.
  • Streams - what they are, stream pipelines and stream laziness.
  • Streams - Terminal operations.
  • Streams - Terminal operations - reduce, collect() explained with code examples.
  • Streams - collect() using API collectors explained with code examples e.g. CollectorsDOTtoMap(), CollectorsDOTgroupingBy() and CollectorsDOTpartitioningBy()
  • Streams - Intermediate Operations explained with code examples e.g. filter(), distinct(), limit(), map(), flatMap() and sorted().
  • Streams - stateful and short-circuiting intermediate operations explained.
  • Streams - Primitive Streams - how to create them, what their API's look like and how to map between them.
  • Streams - mapping between Object streams and primitive streams and vice versa.
  • Optionals - what they are and why they are useful. Sample code demonstrating their use.
  • Parallel Streams - how to create them. Sequential versus parallel stream processing.

Course content

3 sections36 lectures4h 21m total length
  • Introduction6:42

    Explore how functional interfaces define a single abstract method and how lambda expressions implement them, replacing anonymous inner class syntax with concise code.

  • Cloning my GitHub Repo(sitory)3:16

    Clone the public functional programming in Java repository with git clone, install git, copy the repo URL, and import the source into IntelliJ or another IDE.

  • Lambdas in code (using a custom functional interface)3:08

    Explore lambdas with a custom generic functional interface, implement is negative using a lambda with a single abstract method, compare with the standard predicate, and understand syntax and execution timing.

  • Lambdas in code (using Predicate)5:35

    Explore how the predefined Java predicate functional interface uses a test method and a lambda to return a boolean for any input type, demonstrated with integers and strings.

  • Functional Interfaces from the API - Predicate and BiPredicate3:14

    Explore Java functional interfaces from the API, focusing on predicate and BiPredicate. See how the test method uses generics with single and dual inputs in lambdas and string checks.

  • Functional Interfaces from the API - Supplier2:08

    Explore the Java supplier functional interface, its get method, and how to use it with lambdas to produce values with no input, such as strings, local time, and doubles.

  • Functional Interfaces from the API - Consumer and BiConsumer5:00

    Explore consumer and BiConsumer interfaces, showing how accept consumes inputs with no return, including two-argument BiConsumer examples, and how forEach iterates lists and maps to print capitals.

  • Functional Interfaces from the API - Function and BiFunction2:47

    Explore how function interfaces work in Java: the Function and BiFunction types, their apply method, and examples computing string lengths and concatenating strings.

  • Functional Interfaces from the API - UnaryOperator and BinaryOperator3:03

    Explore unary operator as a function where input and output types match, with string examples, and binary operator as a concise form of BiFunction using two same-type inputs.

  • Lambdas - final and effectively final4:15

    Understand final and effectively final local variables in Java lambdas. See how a lambda captures a snapshot of a variable and requires it to remain final or effectively final.

  • Method References2:42

    Learn how method references can replace simple lambdas to call a single method, and explore bound and unbound styles and the compiler’s lambda transformation.

  • Bound Method References4:59

    Explore bound method references in Java by binding a string instance to methods, including converting to lowercase and testing starts with a given prefix, using a supplier and a predicate.

  • Unbound Method References5:01

    Demonstrate unbound method references in Java by replacing lambdas with method references, illustrating how the first parameter becomes the instance and subsequent arguments pass to the method.

  • Static Method References2:55

    Learn how static method references replace lambdas, with unbound references inferred by a one-argument consumer to sort a list of integers using a static collection method.

  • Constructor Method References3:02

    Explore constructor method references in Java, comparing supplier and function usage to instantiate objects like string builder and array list, and harnessing the apply method to pass inputs.

  • Method References and Context5:51

    Explore method references and context in Java, showing how the compiler uses surrounding context to map a method reference to supplier, function, or bi function, with lambda examples.

  • Lambdas Lab
  • Lambdas and Method References

Requirements

  • Intermediate Java. Whereas my "Java 8 OCA (1Z0-808) Course" starts at the beginning, this assumes that the learner has a reasonable level of Java.
  • To make understanding lambdas easier, a familiarity with anonymous inner classes would help. That said, lambdas are contrasted with anonymous inner class syntax in the course.

Description

IMPORTANT - One of my Udemy Business courses, namely, Advanced Java, Explained Simply: Java 8–25 and Spring Boot 3, contains this course as a subset. My advanced Java course contains 33h 45m of content and is worth checking out before investing in this this course (as it is, in my opinion, better value for money).


Sample reviews:

"Great course to learn about two of the most powerful Java 8 new additions, Lambdas and Streams. Thank you!" [Andrei-G C.]

"Excellent course on Java Lambdas and Streams. Doctor Sean Kennedy clearly explained all concepts and techniques using great amount of examples. The assignments reflected what we learned in the course. Thank you Doctor Sean Kennedy!" [Jing H]
"This course provides hands-on knowledge on how to work with functional programming in java. From Lambdas to Optionals, the way Java 8 api adds this new features is really a key factor to productivity and performance." [Calebe O]

"Concise, easy to follow, very useful. Very talented lecturer." [Luka K]

"Sean described lambdas and streams ,covered all the topics in detailed level." [Kalpana M]
"Very good course, learnt many new things. Dr Kennedy should bring out more courses." [Vasudha S.]

"The course is very well-organized and clearly presented. Thank you, Dr. Seán Kennedy." [Ricardo R.]

"Super course, great help with this important area of Java programming." [David F.]

"Excellent course and teacher's explanations." [E. A.]

"Fantastic course, very engaging and delivered in an easy to understand manner."  [Gary W.]

"Excellent Course, the concepts are explained in a clear & concise manner making it easy to understand."  [Bv]

"Content explained clearly and punctually. Recommended" [Daniel M.]

"Very good introduction, clear and easy to understand." [Richard S.]


This course is a systematic approach to explaining in both notes format and code examples, lambda expressions and streams in Java. All the code samples are included (on my GitHub repo).

Topics include:

  • Lambdas:

    • Functional Interfaces

    • Lambdas and their relationship to Functional Interfaces

    • Lambdas in code using a custom Functional Interface

    • Lambdas in code using the pre-defined API Functional Interfaces:

      • Predicate/BiPredicate

      • Supplier

      • Consumer/BiConsumer

      • Function/BiFunction

      • UnaryOperator and BinaryOperator

    • final and "effectively final"

    • Method References:

      • bound

      • unbound

      • static

      • constructor

      • context and it's effect in understanding method references

    • Assignment to reinforce the content

  • Streams:

    • Pipelines

    • Laziness

    • Creating streams

    • Terminal operations:

      • reduce()

      • collect()

        • Collectors.toMap()

        • Collectors.groupingBy()

        • Collectors.partitioningBy()

    • Intermediate operations:

      • filter(), distinct(), limit()

      • map(), flatMap(), sorted()

    • Primitive streams:

      • Creating

      • API

      • Functional Interfaces

      • Mapping between primitive streams

      • Mapping between primitive streams and Object streams and vice versa

    • Optionals

    • Parallel streams

    • Assignment to reinforce the content

This course is geared towards Java Certification i.e. the Predicate lambda sections would suit Java 8 OCA (1Z0-808). The remaining lambda sections and the streams sections would suit any version of Java OCP. This course explains the concepts through small, simple, targeted code examples.

Note that, my other 2 courses, namely "Java 8 OCA (1Z0-808) Certification - Master the Fundamentals" and "Java 21, Java 17, Java 11, Java 8 (advanced) and Spring Boot" have both been selected for the Udemy Business portfolio (only the top 3% of courses qualify).

For those who don't know me, I am a lecturer since 2002 and have taught the Java OCA and OCP syllabii since 2013 on behalf of a highly regarded software company. On completion of the courses with me, graduates then face the company's own internal Java Certification exam (similar in style to Oracle's). I have no visibility into the questions they will face. It is a 3 hour long intensive exam. The company are delighted with the pass rate (100% since year 1). I love teaching and this course has all my experience in explaining lambdas and streams in Java.

Who this course is for:

  • Anyone interested in learning Lambdas and Streams (the Functional Programming aspects of Java 8).