Inspectopedia
 
2024.3

Array comparison using '==', instead of 'Arrays.equals()'

Warning
New
Last modified: 03 December 2024

Reports operators == 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:

After the quick-fix is applied: