A DESCRIPTION OF THE REQUEST :
In the implementation of java.util.Arrays.equals(Object[], Object[]), the loop calls Object.equals for every pair of non-null objects.
for (int i=0; i<length; i++) {
Object o1 = a[i];
Object o2 = a2[i];
if (!(o1==null ? o2==null : o1.equals(o2)))
return false;
}
The following (in the manner of java.util.Objects.equals) would be faster, because it would skip calling equals for all pairs that are simply ==.
for (int i=0; i<length; i++) {
Object o1 = a[i];
Object o2 = a2[i];
if (o1 != o2 && (o1 == null || !o1.equals(o2)))
return false;
}
JUSTIFICATION :
Widely used utility methods like this should have best-possible optimization because this can benefit many programs.