@@ -5795,14 +5795,14 @@ public static <T> int dedupe(final T[] a, final Comparator<? super T> c) {
5795
5795
*
5796
5796
* @param a The first array to compare.
5797
5797
* @param b The second array to compare.
5798
- * @param cmp The comparator to compare array elements.
5798
+ * @param c The comparator to compare array elements.
5799
5799
* @param <T> The type of array elements.
5800
5800
* @return The value {@code 0} if the first and second array are equal and contain the same elements in the same order; a value less
5801
5801
* than {@code 0} if the first array is lexicographically less than the second array; and a value greater than {@code 0} if
5802
5802
* the first array is lexicographically greater than the second array.
5803
5803
* @throws NullPointerException If the comparator is null.
5804
5804
*/
5805
- public static <T > int compare (final T [] a , final T [] b , final Comparator <? super T > cmp ) {
5805
+ public static <T > int compare (final T [] a , final T [] b , final Comparator <? super T > c ) {
5806
5806
if (a == b )
5807
5807
return 0 ;
5808
5808
@@ -5812,17 +5812,19 @@ public static <T> int compare(final T[] a, final T[] b, final Comparator<? super
5812
5812
if (b == null )
5813
5813
return 1 ;
5814
5814
5815
- for (int i = 0 , i$ = Math .min (a .length , b .length ); i < i$ ; ++i ) { // [A]
5815
+ final int aLen = a .length ;
5816
+ final int bLen = b .length ;
5817
+ for (int i = 0 , i$ = Math .min (aLen , bLen ); i < i$ ; ++i ) { // [A]
5816
5818
final T oa = a [i ];
5817
5819
final T ob = b [i ];
5818
5820
if (oa != ob ) {
5819
- final int v = cmp .compare (oa , ob );
5821
+ final int v = c .compare (oa , ob );
5820
5822
if (v != 0 )
5821
5823
return v ;
5822
5824
}
5823
5825
}
5824
5826
5825
- return a . length - b . length ;
5827
+ return aLen - bLen ;
5826
5828
}
5827
5829
5828
5830
private ArrayUtil () {
0 commit comments