==
and !=
used to test for array equality.
In most cases, testing for the equality of array contents is intended,
which can be done with the java.util.Arrays.equals()
method.
A quick-fix is suggested to replace ==
with java.util.Arrays.equals()
.
Example:
void foo(Object[] x, Object[] y) {
boolean comparison = x == y;
}
After the quick-fix is applied:
void foo(Object[] x, Object[] y) {
boolean comparison = Arrays.equals(x, y);
}