arrow-fx-coroutines / arrow.fx.coroutines.stream / cons1

cons1

fun <O> Stream<O>.cons1(o: O): Stream<O>

Prepends a value onto the front of this stream.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream(1, 2, 3).cons1(0)
    .toList()
  .  let(::println) // [0, 1, 2, 3]
//sampleEnd

Do you like Arrow?

Arrow Org
<