arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / takeThrough
fun takeThrough(p: (O) ->
Boolean
):
Stream
<O>
Like takeWhile, but emits the first value which tests false.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream.range(0..1000)
.takeThrough { it != 5 }
.toList()
.let(::println) // [0, 1, 2, 3, 4, 5]
//sampleEnd
Do you like Arrow?
✖