4 ms·
What's wrong with imperative versions of these examples? Is imperative code not allowed or something?
by zb3 3y ago
What's wrong with imperative versions of these examples? Is imperative code not allowed or something?
- SomeDaysBe 3y agoStreams can tend to be more readable and easier to write for the right problem set. This is because it is super easy to compose basic functions together which are then invoked by the Stream API. It also makes it really easy to parallelize operations.
- smrtinsert 3y agoFor code coverage purposes I love the fact that there's only one branch of code to focus on. A lot of my code with streams instantly starts with a return statement and then has a 5-10 lines of stream operation invocations. Very clean stuff.