Summary
The divide and conquer design technique is a very popular approach to solve different kinds of problems. You divide the original problem into smaller problems and those problems into smaller ones until we have enough simple problems to solve it directly. In version 7, the Java concurrency API introduced a special kind of Executor
optimized for these kinds of problems. It's the Fork/Join Framework. It's based on the following two operations:
fork: This allows you to create a new child task
join: This allows you to wait for the finalization of a child task and get its results
Using those operations, Fork/Join tasks have the following appearance:
if ( problem.size() > DEFAULT_SIZE) { childTask1=new Task(); childTask2=new Task(); childTask1.fork(); childTask2.fork(); childTaskResults1=childTask1.join(); childTaskResults2=childTask2.join(); taskResults=makeResults(childTaskResults1, childTaskResults2); return taskResults; } else { taskResults=solveBasicProblem...