Is there an equivalent Flow construct for the sequ...
# flow
b
Is there an equivalent Flow construct for the sequence predicates
any
and
all
? I need a way to short circuit a Flow if a value is ever found matching a predicate, similar to `anyMatch`/`allMatch`/`noneMatch` in the Java Streams API
This is the closest thing I found, but it seems like there should be a simpler way:
Copy code
.firstOrNull { ... } != null
m
takeWhile?
(to replace any)
And all would just be a typical collect where you reduce the values, yeah?
actually you have reduce() already
b
reduce
wouldn’t work since it doesn’t short circuit. I guess
takeWhile
works, but it’s the same problem as
firstOrNull
since I don’t need the values themselves, just the Boolean
m
right