Sitemap
Javarevisited

A humble place to learn Java and Programming better.

Member-only story

Java Stream API Intermediate vs Terminal Operations

--

I recommend my Udemy Course to Learn Java Streams and Functional Programming in-depth: Functional Programming in Java (Includes Java Collections) ❤️

Explore all 15+ of my Udemy courses with discount coupons 👇

Java 8 introduced the powerful Stream API, which enables functional-style operations on collections with a clear and concise syntax.

A stream in Java represents a sequence of elements that supports various operations to process those elements. These operations are divided into two categories:

  1. Intermediate Operations
  2. Terminal Operations

A typical stream pipeline looks like:

List<String> names = Arrays.asList("Amit", "Sneha", "Rahul");

names.stream() // Stream source
.filter(n -> n.startsWith("A")) // Intermediate
.map(String::toUpperCase) // Intermediate
.forEach(System.out::println); // Terminal

🧠 Key Differences Between Intermediate and Terminal Operations

Here’s a quick summary table that outlines the core differences:

--

--

No responses yet