Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0
-
None
-
None
-
Operating System: other
Platform: Other
-
30815
Description
ArrayUtils.isEquals() throws ClassCastException when array1 and array2 are
different dimension.
For example:
boolean[][] array1 = new boolean[][] {
{ true, false }, { true, false } };
boolean[] array2 = new boolean[]
;
if( ArrayUtils.isEquals( array1, array2 ) ){ // <== ClassCastException
:
How about the following implementation to avoid the exception?
public static boolean isEquals(final Object array1, final Object array2) {
if( !isSameType( array1, array2 ) ) return false;
return new EqualsBuilder().append(array1, array2).isEquals();
}