arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / forall
fun forall(p: (O) ->
Boolean
):
Stream
<
Boolean
>
Emits false
and halts as soon as a non-matching element is received; or
emits a single true
value if it reaches the stream end and every input before that matches the predicate;
or hangs without emitting values if the input is infinite and all inputs match the predicate.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, 3, 4, 5)
.forall { it < 10 }
.toList()
.let(::println) //[true]
//sampleEnd
Return Either a singleton or a never stream:
Do you like Arrow?
✖