Java logoJava/
JAVA-S0347

Arrays are not equal to non-array valuesJAVA-S0347

Major severityMajor
Bug Risk categoryBug Risk

This method invokes the equals(Object o) method to compare an array and a reference that doesn't seem to be an array. If the objects being compared are of different types, they are guaranteed to be unequal and the comparison is almost certainly an error. Even if they are both arrays, the equals method on arrays only determines if the two arrays are the same object.

To compare the contents of two arrays, use java.util.Arrays.equals(Object[], Object[]).