The merge sort algorithm is a very popular sorting algorithm that is always implemented using the divide and conquer technique, so it's a very good candidate to test with the Fork/Join framework.
To implement the merge sort algorithm, we divide the unsorted lists into sublists of one element. Then, we merge those unsorted sublists to produce ordered sublists until we have processed all the sublists, and we have only the original list, but with all the elements sorted.
To make the concurrent version of our algorithm, we have used the new Fork/Join tasks, the
CountedCompleter tasks, introduced in the Java 8 version. The most important characteristics of these tasks are that they include a method to be executed ...