public class ExecutorUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <E,R> ImmutableList<R> |
parallelExecution(ExecutorService executor,
Collection<E> elements,
Function<E,R> mappingFunction)
Similar to parallel stream but executes in
ExecutorService not ForkJoinPool.commonPool(). |
public static <E,R> ImmutableList<R> parallelExecution(ExecutorService executor, Collection<E> elements, Function<E,R> mappingFunction) throws InterruptedException, ExecutionException
ExecutorService not ForkJoinPool.commonPool().
Another difference is that execution is always forked regardless of the job size.executor - elements - mappingFunction - ExecutionException - when mappingFunction throws exceptionInterruptedExceptionCopyright © 2015. All rights reserved.