Lambdas and stream pipelines

What values appear in the resulting list?

Examples

Worked example

Input
[2, 3, 4, 5], keep even values, then double them
Expected output
[4, 8]

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

Filtering keeps 2 and 4. Mapping doubles each, preserving their encounter order in this pipeline.

Back to the lesson