Class Arrays
public static void sort(T[] a)
Parameters:
a - the array to be sorted
Implementation note (truncated):
- Dual-Pivot Quicksort and offers O(n log(n)) performance on many data sets.
- Faster than traditional (one-pivot) Quicksort implementations.
Class Collections
public static > void sort(List list)
Parameters:
list - the list to be sorted.
Implementation note (truncated):
- Is a mergesort that requires far fewer than n lg(n) comparisons when the input array is partially sorted, while offering the performance of a traditional mergesort when the input array is randomly ordered.
- If the input array is nearly sorted, the implementation requires approximately n comparisons.
- Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays.
Summation
- They are based on different types of data with one in Array and another in List.
- When concerning the time complexity, it depends on the data is partially sorted or randomly sorted
- When concerning the space, Arrays.sort requires constant time, but Collections.sort may take up to n/2 space.