Module 13: Functional Programming and Streams
Filter, Map, and Other Intermediate Operations
Filter, map, and reshape data with clear stream pipelines.
Author
Java Learner Editorial Team
Reviewer
Technical review by Java Learner
Last reviewed
2026-04-17
Java version
Java 25 LTS
Learning goals
- Use `filter`, `map`, and `sorted` confidently
- Read a stream pipeline from left to right
- Keep pipelines understandable instead of clever
Intermediate operations build the pipeline: filter removes items, map transforms them, and sorted reorders them.
Read pipelines in stages: source, filter, transform, collect. That mental sequencing helps a lot when debugging.
Keep lambdas small: If the lambda logic gets dense, extract a method reference or named helper.
Do not cram everything into one chain if it hurts readability: Streams are a tool, not a contest.
Runnable examples
Filter then transform
import java.util.List;
List<String> result = List.of("ada", "grace", "linus").stream()
.filter(name -> name.length() > 3)
.map(String::toUpperCase)
.toList();
System.out.println(result);Expected output
[GRACE, LINUS]
Mini exercise
Take a list of numbers, keep only even values, then multiply each remaining number by 10.
Summary
- `filter` removes items, `map` transforms them.
- Readable pipelines beat overly dense one-liners.
- Stage-by-stage thinking makes streams easier to debug.
Next step
Finish the data flow by learning terminal operations such as `toList`, `count`, and `reduce`.
Sources used