Arrays.parallelSort(). It’s kinda the same as
Arrays.sort(), but differently.
It’s faster. Well, not every time. But for Arrays with more than 2000 Elements, it’s faster. Why? Due to the Fork/Join framework introduced in Java7. The function assigns the sorting tasks to multiple threads available in the thread pool. This makes it faster in comparison to
sort(). The efficiency grows directly proportional to the number of elements in the array.
Here’s how it affects the speed: (x-axis is time, y-axis is number of elements)
The function is pretty simple to use:
Arrays.parralelSort(myArray, [optional int fromIndex], [optional int toIndex]);