DEV Community

Cover image for Iterating collections and arrays in parallel by setting thread priority
Roberto Gentili for Burningwave

Posted on • Updated on

Iterating collections and arrays in parallel by setting thread priority

Through the underlying configurable BackgroundExecutor the IterableObjectHelper component is able to iterate a collection or an array in parallel and execute an action on each iterated item giving also the ability to set the threads priority. Before starting to use this component we need to add the following dependency to our pom.xml:

… And now let’s see the code:

Discussion (0)