contramap
Transform this Flow by applying a function to each incoming upstream element before it is passed to the Flow.
Signature
Description
Transform this Flow by applying a function to each incoming upstream element before it is passed to the Flow.
Examples
- Scala
-
source
import org.apache.pekko.NotUsed import org.apache.pekko.stream.scaladsl._ val flow: Flow[Int, Int, NotUsed] = Flow[Int] val newFlow: Flow[String, Int, NotUsed] = flow.contramap(_.toInt)
Reactive Streams semantics
emits when the mapping function returns an element
backpressures ’‘‘Backpressures when’’’ original flow backpressures
completes when upstream completes
cancels when original flow cancels
1.1.2+29-e21fa9eb*