Skip to content

Instantly share code, notes, and snippets.

@jumar
Created January 21, 2015 01:29
Show Gist options
  • Save jumar/e0eae891eff704683ba7 to your computer and use it in GitHub Desktop.
Save jumar/e0eae891eff704683ba7 to your computer and use it in GitHub Desktop.
Parellel strem on dedicated thread pool
ForkJoinPool forkJoinPool = new ForkJoinPool(2);
forkJoinPool.submit(() ->
range(1, 1_000_000).parallel().filter(PrimesPrint::isPrime)
.collect(toList())
).get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment