Add ArrayUtils.isSameLength() to compare more array types #430.

This commit is contained in:
Gary Gregory 2020-05-24 11:05:21 -04:00
parent f692351035
commit daa4193fb2
2 changed files with 1353 additions and 2 deletions

View File

@ -3406,8 +3406,23 @@ public static int indexOf(final int[] array, final int valueToFind) {
return getLength(array1) == getLength(array2);
}
// Is same length
//-----------------------------------------------------------------------
/**
* <p>Checks whether two arrays are the same length, treating
* {@code null} arrays as length {@code 0}.
*
* <p>Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be {@code null}
* @param array2 the second array, may be {@code null}
* @return {@code true} if length of arrays matches, treating
* {@code null} as an empty array
* @since 3.11
*/
public static boolean isSameLength(final Object array1, final Object array2) {
return getLength(array1) == getLength(array2);
}
/**
* <p>Checks whether two arrays are the same length, treating
* {@code null} arrays as length {@code 0}.

File diff suppressed because it is too large Load Diff