Module 10: Functional Programming and Streams
Intermediate Operations
Chain filter, map, flatMap, distinct, sorted, and peek effectively.
filter retains elements matching a predicate; map transforms each element; flatMap flattens nested streams.
Use peek for debugging only—it should not mutate state in production pipelines.
distinct relies on equals/hashCode; sorted can accept custom comparators via lambdas or method references.