Java example: Streams API
Transform and reduce a list using the Java Streams API.
Demonstrates the Java Streams API for functional-style data processing. It calls .stream() on a List<Integer>, uses .filter() to keep even numbers, .mapToInt() to convert to an IntStream of squares, and .sum() to reduce them to a single total. This replaces an explicit loop with a readable, declarative pipeline.