Java logoJava/
JAVA-S0349

`equals` can't be used to compare arrays of different typesJAVA-S0349

Major severityMajor
Bug Risk categoryBug Risk

This method invokes the equals(Object o) method to compare two arrays, but the arrays involved are of incompatible types (e.g., String[] and StringBuffer[], or String[] and int[]). They will never be equal. In addition, when equals(...) is used to compare arrays it only checks to see if the given references are the same, and ignores the contents of the arrays.

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