map
Transform each element in the stream by calling a mapping function with it and passing the returned value downstream.
Signature¶
Description¶
Transform each element in the stream by calling a mapping function with it and passing the returned value downstream.
Examples¶
sourceimport 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.3