What this animation explains
Intermediate operations are lazy; terminal operation triggers processing. This visualization groups by stage for clarity; sequential streams may fuse filter and map per element. toList returns an unmodifiable list.

MODULE 1 · TOPIC 8 · VISUAL PROGRAMMING LAB
Follow data through lazy filter and map operations into terminal results.
Browser-based simulations: change the inputs, trace the Java statements and inspect results. No arbitrary Java execution, real database, threads or file changes occur here.
Watch values enter and leave each stage.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
Intermediate operations are lazy; terminal operation triggers processing. This visualization groups by stage for clarity; sequential streams may fuse filter and map per element. toList returns an unmodifiable list.
Set threshold 100; see empty output. Change bonus and compare.
Track accumulator and next element.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
reduce combines values using an associative operation and an identity. Summation is a standard reduction.
Set all prices to 0, then 120,80,50.
Observe stateful operations and ordering.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
distinct removes equal duplicates; sorted orders elements; limit short-circuits the result. Streams cannot be reused after a terminal operation.
Compare descending and ascending with limit=2.
Given a list of employees, filter salaries above a threshold, map to names and collect. Calculate total salary with mapToInt().sum().
Edit the scratchpad below. Copy your code into an actual Java project or IDE to compile and test it.
Prefer stateless, non-interfering stream operations. Parallel streams require safe associative reductions and are not automatically faster.