CHAPTER 25
Beginner
Java Streams and Lambda Expressions
Updated: May 17, 2026
5 min read
# CHAPTER 25
Java Streams and Lambda Expressions
1. Introduction
Java 8 revolutionized the language with functional programming features. Lambda expressions provide concise syntax for anonymous functions, and the Streams API enables powerful, declarative data processing pipelines.2. Lambda Expressions
A shorter way to implement functional interfaces:
java
Syntax: (parameters) -> expression or (parameters) -> { statements; }
3. Functional Interfaces
Common built-in functional interfaces:
java
4. Streams API
A stream is a pipeline that processes data from a source (collection, array):
java
5. Common Stream Operations
filter(): Keep elements matching a condition
java
map(): Transform each element
java
reduce(): Combine all elements into one
java
sorted():
java
distinct():
java
count():
java
6. Method References
Shorthand for lambdas that call a single method:
java
7. Collectors
java
8. MCQ Quiz with Answers
Question 1
Lambda syntax is:
Question 2
Streams are:
Question 3
filter() does what?
Question 4
map() does what?
Question 5
reduce() does what?
Question 6
collect(Collectors.toList()) does what?
Question 7
Method reference String::toUpperCase is equivalent to:
Question 8
A Predicate returns:
Question 9
Streams are:
Question 10