Robert

51%
Flag icon
In summary, some tasks are best accomplished with streams, and others with iteration. Many tasks are best accomplished by combining the two approaches. There are no hard and fast rules for choosing which approach to use for a task, but there are some useful heuristics. In many cases, it will be clear which approach to use; in some cases, it won’t. If you’re not sure whether a task is better served by streams or iteration, try both and see which works better.
Robert
Something that's not touched on here (will it be later?) is a recommendation on the use of streams at a more architectural level. That is, here we see the comparison of streams vs non-streams mostly just inside of a method. However, I've seen applications that "replace" their stack with streams. For example, whereas a traditional mobile app will have networking, data, and UI layers fairly well separated, I've seen apps brings all of those into a stream built in the controller. (Long story short, I think that's bad.)
Effective Java
Rate this book
Clear rating
Open Preview