3 ms·
i 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., wh
by chii 11y ago
i 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.