4 ms·
The .parallel() method in Java Streams is basically one of my favourite magic spells ever.
by jacques_chester 8y ago
The .parallel() method in Java Streams is basically one of my favourite magic spells ever.
- spricket 8y agoAh yes, parallel stream(), for when you need to filter a list of 13000 entries for.... Reasons. Bad reasons. Use it all the time :)
- jacques_chester 8y agoI tried it once on a simple monte carlo thingy and legitimately said "wow!" out loud when it just worked. God, all the fussing with threads and fork-joins and mapreduces and god knows what everyone else wanted me to do: gone. Gone!
- spricket 8y agoYeah seriously Java's threading support is good but the boilerplate was horrific. One thing you should know is that parallel streams use default thread pool unless you specify otherwise. Had that choke up some REST handler threads a few times. If you think it might be an issue make sure to specify a different pool