Skip to content
Sharp

Reactive Streams · interview question

How does flatMap differ from map in reactive streams?

Multiple choiceMediumchapter-19-curatedpremiumreactive-streamsblocking-the-event-loop
Choose one answer
Answer and explanation

Correct answer

C. FlatMap flattens the stream by mapping each element to a stream.

Why

flatMap is used when each element of the original stream needs to be transformed into a new stream, and those streams need to be flattened into a single stream. This is useful for chaining asynchronous operations.

Test yourself on Reactive Streams

A free test with instant, explained results. No account needed.

Start free test
All Reactive Streams questions →