3 ms·
The benefits of streams isn't performance improvements for the CPU, but performance improvements for the developer.
by mabbo 11y ago
The benefits of streams isn't performance improvements for the CPU, but performance improvements for the developer.
- chii 11y agoi have colleges that claim streams don't necesserily make the code more readable. Imagine a triple nested for-loop - making it a triple nested streams (e.g., where your map method is yet another stream), doesn't seem to really make it any more readable. The only reason to use streams, i think is the possibility to automatically parrelize, and secondarily to make it more readable.
- mabbo 11y agoI would take any triply-nested for loops, and reduce each loop to its own method. Inside that method would be nice, easy-to-understand stream logic rather than for-loops. The Java compiler will unroll the methods anyways, so you get easy readability without any loss of performance.