Stream Processing | It processes a stream of values | It processes a stream of stream of values |
Operation | It only does mapping | It performs both mapping and flattening |
Mapper Function | Its mapper function produces a single value for each input value | Its mapper function produces multiple values for each input value |
Mapping | It is a One-To-One mapping | It is a One-To-Many mapping |
Data Transformation | From Stream<T> to Stream<R> | From Stream<Stream<T>> to Stream<R> |
Use Case | Use this method when the mapper function is producing a single value for each input value | Use this method when the mapper function is producing multiple values for each input value |