4 ms·
I think your point is valid with a trivial example as shown in the article. In a more complex example, with multiple steps and potentially multiple streams, us
by kitd 5y ago
I think your point is valid with a trivial example as shown in the article.
In a more complex example, with multiple steps and potentially multiple streams, using the Streams API allows the algorithmic and business logic parts of the whole calculation to be kept separate, more visible and more maintainable/adaptable as a result. Imperative code in such cases usually involves factoring out chunks of the for-loop into separate functions or classes which IME goes in the opposite direction.