Challenge 2: Predicate and Function Applied to a List — Possible Solution ==================================================================== FunctionalDemo.java: import java.util.List; import java.util.function.Function; import java.util.function.Predicate; public class FunctionalDemo { public static void main(String[] args) { List numbers = List.of(1, 2, 3, 4, 5, 6); Predicate isEven = n -> n % 2 == 0; Function square = n -> n * n; for (int n : numbers) { if (isEven.test(n)) { System.out.println(n + " is even, squared: " + square.apply(n)); } } } } Output: 2 is even, squared: 4 4 is even, squared: 16 6 is even, squared: 36 Explanation: isEven.test(n) calls Predicate's single abstract method, returning a boolean. square.apply(n) calls Function's single abstract method, returning the transformed value. Both are ready-made functional interfaces from java.util.function -- neither required a custom interface to be declared, matching the chapter's own tip-box guidance. WHY THIS WORKS AS AN ANSWER ------------------------------ This uses Predicate and Function exactly as the chapter introduces them -- test() and apply() as each interface's single abstract method -- applied together over a real list rather than in isolation.