map
Transform each element in the stream by calling a mapping function with it and passing the returned value downstream.
Signature
Source.map
Source.map
Flow.map
Flow.map
Description
Transform each element in the stream by calling a mapping function with it and passing the returned value downstream.
Examples
- Scala
-
source
import org.apache.pekko import pekko.NotUsed import pekko.stream.scaladsl._ val source: Source[Int, NotUsed] = Source(1 to 10) val mapped: Source[String, NotUsed] = source.map(elem => elem.toString)
Reactive Streams semantics
emits when the mapping function returns an element
backpressures when downstream backpressures
completes when upstream completes
1.1.2+29-e21fa9eb*