3 ms·
It's also to separate the methods doing computation lazily (Stream) from the one doing computation eagerly (Collection). Otherwise a simple call like isEmpty()
by _old_dude_ 8y ago
It's also to separate the methods doing computation lazily (Stream) from the one doing computation eagerly (Collection).
Otherwise a simple call like isEmpty() can trigger the whole computation like in Haskell.
As a user of the API, you have to wrap your code into a Stream to be lazy evaluated, the Stream being a computation monad, so you always know if a code is evaluated eagerly or lazily.