/** * Returns the targeted parallelism level of the common pool. * * @return the targeted parallelism level of the common pool * @since 1.8 */ publicstaticintgetCommonPoolParallelism(){ return commonParallelism; }
下面主要看一下DualPivotQuicksort.sort(双轴快速排序)这个方法的实现,
1 2 3 4 5 6 7 8 9
staticvoidsort(int[] a, int left, int right, int[] work, int workBase, int workLen){ // Use Quicksort on small arrays if (right - left < QUICKSORT_THRESHOLD) { sort(a, left, right, true); return; } ... }
/** * Sorts the specified range of the array by Dual-Pivot Quicksort. * * @param a the array to be sorted * @param left the index of the first element, inclusive, to be sorted * @param right the index of the last element, inclusive, to be sorted * @param leftmost indicates if this part is the leftmost in the range */ privatestaticvoidsort(int[] a, int left, int right, boolean leftmost){ int length = right - left + 1; if (length < INSERTION_SORT_THRESHOLD)