There are two main ways to operate on Java streams:
- parallelStream()
- stream()
As this post Should I always use a parallel stream when possible? indicated, there are downsides to using parallel streams.
Is there a way to dynamically switch between those types built into Java?
So to use parallel streams for large collections and normal streams for small collections.
Something like: myCollection.parallelStreamIfNeeded()