-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P5
-
None
-
Affects Version/s: None
-
Component/s: core-libs
In Java 8 a default method List.sort() was added. The default implementation uses a slow copyout-sort-copyback algorithm. But specific List implementations can override sort() to provide a better implementation. For example, ArrayList.sort() sorts in-place.
In Java 8 the Arrays.parallelSort() method was also added, which does a parallel, in-place sort on an array.
Unfortunately, there doesn't appear to be an effective way to do a parallel sort on a List. Clearly one could implement the copyout-parallelsort-copyback algorithm, but this is wasteful if the List's internal representation would allow an in-place parallel sort to occur. This suggests the addition of a new default method List.parallelSort() which could be overridden by ArrayList to do in-place sorting in parallel.
See also this StackOverflow answer:
http://stackoverflow.com/a/25962666/1441122
In Java 8 the Arrays.parallelSort() method was also added, which does a parallel, in-place sort on an array.
Unfortunately, there doesn't appear to be an effective way to do a parallel sort on a List. Clearly one could implement the copyout-parallelsort-copyback algorithm, but this is wasteful if the List's internal representation would allow an in-place parallel sort to occur. This suggests the addition of a new default method List.parallelSort() which could be overridden by ArrayList to do in-place sorting in parallel.
See also this StackOverflow answer:
http://stackoverflow.com/a/25962666/1441122