arrow-fx-coroutines / arrow.fx.coroutines.stream / terminateOnNull
fun <O> Stream<O>.terminateOnNull(): Stream<O>
Halts the input stream at the first null.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, null, 3, null)
.terminateOnNull()
.toList()
.let(::println) //[1, 2]
//sampleEnd
Do you like Arrow?
✖