arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / exists
fun exists(f: (O) ->
Boolean
):
Stream
<
Boolean
>
Emits true
as soon as a matching element is received, else false
if no input matches.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit {
Stream.range(0..10).exists { it == 4 }
.toList().let(::println) //[true]
Stream.range(0..10).exists { it == 11 }
.toList().let(::println) //[false]
}
//sampleEnd
Return
Either a singleton stream, or a never
stream.
Do you like Arrow?
✖