Buttink Buttink - 1 month ago 8
Java Question

How to tell that any object in a observable satisfies a condition?

I have looked and it seems like there is an "All" operation that will tell if all items satisfy a condition but no "Any" is this just an oversight or am I missing something? I could recreate it with other operations, but I could say the same thing with All.

Observable.just(1,5,10)
.filter(i -> i < 7)
.reduce((c,n) -> c && n) // or "||" for any
.subscribe(b -> /* do stuff */);


Am I missing something or is there really just no Any?

Answer

It was named exists in 1.x (and is again any in 2.x).