Friday, October 9, 2015

Limit a infinite stream by a predicate

We know the stream.iterate can generate a infinite stream. The infinite stream can be limited by specific number, like stream.limit(100).
But if we don't know the exact number, we want to stop when one predicate returns true. How to do that?

No comments:

Post a Comment