compare
Compares two int arrays lexicographically over the specified ranges.
If the two arrays, over the specified ranges, share a common prefix then the lexicographic comparison is the result of comparing two elements, as if by Integer.compare, at a relative index within the respective arrays that is the length of the prefix. Otherwise, one array is a proper prefix of the other and, lexicographic comparison is the result of comparing the two range lengths. (See .mismatch for the definition of a common and proper prefix.)
The comparison is consistent with .equals, more specifically the following holds for arrays a and b with specified ranges [aFromIndex, aToIndex) and [bFromIndex, bToIndex) respectively:
`Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0) `*
Return
the value 0 if, over the specified ranges, the first and second array are equal and contain the same elements in the same order; a value less than 0 if, over the specified ranges, the first array is lexicographically less than the second array; and a value greater than 0 if, over the specified ranges, the first array is lexicographically greater than the second array
Since
9
Parameters
the first array to compare
the index (inclusive) of the first element in the first array to be compared
the index (exclusive) of the last element in the first array to be compared
the second array to compare
the index (inclusive) of the first element in the second array to be compared
the index (exclusive) of the last element in the second array to be compared
Throws
if aFromIndex > aToIndex or if bFromIndex > bToIndex
if aFromIndex < 0 or aToIndex > a.length or if bFromIndex < 0 or bToIndex > b.length
if either array is null
Compares two long arrays lexicographically over the specified ranges.
If the two arrays, over the specified ranges, share a common prefix then the lexicographic comparison is the result of comparing two elements, as if by Long.compare, at a relative index within the respective arrays that is the length of the prefix. Otherwise, one array is a proper prefix of the other and, lexicographic comparison is the result of comparing the two range lengths. (See .mismatch for the definition of a common and proper prefix.)
The comparison is consistent with .equals, more specifically the following holds for arrays a and b with specified ranges [aFromIndex, aToIndex) and [bFromIndex, bToIndex) respectively:
`Arrays.equals(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == (Arrays.compare(a, aFromIndex, aToIndex, b, bFromIndex, bToIndex) == 0) `*
Return
the value 0 if, over the specified ranges, the first and second array are equal and contain the same elements in the same order; a value less than 0 if, over the specified ranges, the first array is lexicographically less than the second array; and a value greater than 0 if, over the specified ranges, the first array is lexicographically greater than the second array
Since
9
Parameters
the first array to compare
the index (inclusive) of the first element in the first array to be compared
the index (exclusive) of the last element in the first array to be compared
the second array to compare
the index (inclusive) of the first element in the second array to be compared
the index (exclusive) of the last element in the second array to be compared
Throws
if aFromIndex > aToIndex or if bFromIndex > bToIndex
if aFromIndex < 0 or aToIndex > a.length or if bFromIndex < 0 or bToIndex > b.length
if either array is null