arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / map

map

fun <B> map(f: (O) -> B): Stream<B>

Applies the specified pure function to each input and emits the result.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream("Hello", "World!")
    .map(String::length)
    .toList().let(::println) // [5, 6]
//sampleEnd

Do you like Arrow?

Arrow Org
<