An intermediate operation adds a transformation to a functional pipeline without processing data immediately. It keeps intent visible and defers evaluation until a terminal operation triggers execution. section 6.3.1 section 6.5
In a Java stream pipeline, intermediate operations commonly:
- Filter elements with a predicate, retaining only values that satisfy a condition. section 6.3.1
- Map elements into another representation, such as converting books into author names. section 6.3.1
- Chain multiple transformations while postponing processing until operations such as toList, collect, or count execute the pipeline. section 6.5
Filter, then map
A readable pipeline selects books published within the last year and extracts their authors: books.stream().filter(book -> book.publishedDate().isAfter(LocalDate.now().minusYears(1))).map(Book::author).toList(). The filter and map operations describe the work; toList performs it and materializes the result. section 6.3.1 section 6.5
List<String> authorNames = books.stream() #1 .filter(book -> book.publishedDate() #2 .isAfter(LocalDate.now().minusYears(1))) #2 .map(Book::author) #2 .toList(); #3
The annotated listing separates stream creation, intermediate operations, and the terminal operation in one complete Java example. section 6.3.1


