Arrays do not override the Object.equals()
method; rather, the implementation of the equals()
method compares an array 's references rather than its their contents. To compare the contents of two arrays, use the two-argument Arrays.equals()
method instead. When intentionally testing reference equality, use the reference equality operators, ==
and !=
. Inappropriate use of the equals()
method can lead to unexpected results. Consequently, programs must reserve use of the array equality operators == and != for testing whether two array references specifically refer to the same array object, and are required to use the two-argument Arrays.equals()
method for all other cases.
Noncompliant Code Example
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="efd67148c70ca68c-530521c0-454e4d50-93f7a45e-7f0e8f549417d7fe0d90e84a"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. Bibliography#API 06]] | [Class | http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...