What is the best way, how to implement parallel for loop with a specified number of threads? Like this:
int maxThreads=5;
int curretnThreads=0;
for(int i = 0; i < 10000; i++){
if(currentThreads<maxThreads){
start thread......
}else{
wait...
}
}
runnable,threadclass, or how?StreamAPI. The second best way is to useExecutorService.fixedThreadPool. The absolute worst way is to use rawThreads.