Module 13: Functional Programming and Streams
Functional Interfaces You Will Actually Use
Use core functional interfaces that appear often in streams and callbacks.
Author
Java Learner Editorial Team
Reviewer
Technical review by Java Learner
Last reviewed
2026-04-17
Java version
Java 25 LTS
Learning goals
- Identify the most common functional interfaces
- Match each interface to its role
- Use `@FunctionalInterface` correctly
A functional interface has one abstract method: That single method is what the lambda implements.
Common built-ins are worth learning early: Predicate<T> tests, Function<T,R> transforms, Consumer<T> uses a value, and Supplier<T> creates or provides one.
These names describe data flow: Does the code test, transform, consume, or produce?
@FunctionalInterface is a helpful signal: It tells readers the interface is meant for lambda use and gives compiler protection.
Runnable examples
Predicate checks a condition
import java.util.function.Predicate;
Predicate<Integer> isEven = number -> number % 2 == 0;
System.out.println(isEven.test(8));Expected output
true
Mini exercise
Create a `Function<String, Integer>` that returns the length of a string.
Summary
- Functional interfaces are lambda targets.
- Built-in interfaces cover the most common behavior shapes.
- Their names usually tell you exactly what role they play.
Next step
Next, start building stream pipelines from collections and arrays.
Sources used