Use when you need to apply functional programming principles in Java — including writing immutable objects and Records, pure functions, functional interfaces, lambda expressions, Stream API pipelines, Optional for null safety, function composition, higher-order functions, pattern matching for instanceof and switch, sealed classes/interfaces for controlled hierarchies, Stream Gatherers for custom operations, currying/partial application, effect boundary separation, and concurrent-safe functional patterns. Part of the skills-for-java project
77
71%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/142-java-functional-programming/SKILL.mdIdentify and apply functional programming principles in Java to improve immutability, expressiveness, and maintainability.
What is covered in this Skill?
Function, Predicate, Consumer, Supplier, custom @FunctionalInterfacetoUnmodifiable* collectorsOptional idiomatic usage: map/flatMap/filter/orElse* over isPresent()+get()andThen/composeinstanceof and switch (Java 21)List.of(), Collectors.toUnmodifiableList()Scope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.
Before applying any functional programming changes, ensure the project compiles. If compilation fails, stop immediately — do not proceed until the project compiles successfully. Verify that maven-compiler-plugin source/target supports the Java features being used.
./mvnw compile or mvn compile before applying any changes./mvnw clean verify or mvn clean verify after applying improvementsFor detailed guidance, examples, and constraints, see references/142-java-functional-programming.md.
7772a1b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.