Package util
Class Arrays
java.lang.Object
util.Arrays
Class for some extended array utility functions.
In contrast to java.util.Arrays
, which provides
functions for sorting arrays with a compareTo
function
that takes one argument, the function in this class uses a
compareTo
function with two arguments. The second
argument can be used to modify the behavior of the comparison
function. The sorting algorithm is a modified quicksort, which
switches to insertion sort once the array sections to be sorted
are small enough.
- Since:
- 2002.04.02
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Interface for extendedcompareTo
function. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
sort
(Arrays.CompareTo2[] array, int from, int to, Object data) Sort an arbitrary array.static void
sort
(Arrays.CompareTo2[] array, Object data) Sort an arbitrary array.
-
Constructor Details
-
Arrays
public Arrays()Create an arrays object (dummy).- Since:
- 2023.07.26 (Christian Borgelt)
-
-
Method Details
-
sort
Sort an arbitrary array.- Parameters:
array
- the array to sortfrom
- the start index of the section to sortto
- the end index of the section to sort (exclusive)data
- the additional data for the the comparisons- Since:
- 2002.04.02 (Christian Borgelt)
-
sort
Sort an arbitrary array.- Parameters:
array
- the array to sortdata
- the additional data for the the comparisons- Since:
- 2002.04.02 (Christian Borgelt)
-