Java Utililty Methods Array Equal

List of utility methods to do Array Equal

Description

The list of methods to do Array Equal are organized into topic(s).

Method

booleanarrayEquals(String[] targetMethodParamTypes, String[] paramTypes)
array Equals
if (targetMethodParamTypes == null && paramTypes == null) {
    return true;
if (targetMethodParamTypes == null) {
    return false;
if (paramTypes == null) {
    return false;
...
booleanarrayEqualsExceptNull(Object[] a1, Object[] a2)
array Equals Except Null
if ((a1 == null) && (a2 == null)) {
    return true;
if (a1 == null && a2 != null && a2.length == 0) {
    return true;
if (a2 == null && a1 != null && a1.length == 0) {
    return true;
...
booleanarrayEqualsSubset(final byte[] array, final int... elements)
Checks that the byte array given matches the series of elements given as the varargs parameters.
try {
    for (int i = 0; i < elements.length; i++)
        if (array[i] != (byte) elements[i])
            return false;
} catch (final ArrayIndexOutOfBoundsException e) {
    return false;
return true;
...
booleanarraysAreEqual(double[] a1, double[] a2)

Compare two double arrays and return true if both not null, and are of equal length and contain equal values.

boolean result = true;
if (a1 == null || a2 == null || a1.length != a2.length) {
    result = false;
} else {
    for (int i = 0; i < a1.length; ++i) {
        if (Math.abs(a1[i] - a2[i]) > 0.000001) {
            result = false;
            break;
...
booleanarraysAreEqual(final byte[] array1, final byte[] array2)
Check if two byte arrays are equal.
if (array1.length != array2.length)
    return false;
for (int i = 0; i < array1.length; i++) {
    if (array1[i] != array2[i])
        return false;
return true;
booleanarraysAreEqual(Object value, Object otherValue)
Returns true if the objects are array instances and each of their elements compares via equals as well.
if (value instanceof Object[]) {
    if (otherValue instanceof Object[]) {
        return valuesAreTransitivelyEqual((Object[]) value, (Object[]) otherValue);
    return false;
return false;
booleanarraysEqual(boolean[] a, boolean[] b)
arrays Equal
return arrayRegionsEqual(a, 0, a.length, b, 0, b.length);
booleanarraysEqual(byte array1[], byte array2[])
arrays Equal
if (array1.length != array2.length) {
    return false;
for (int i = 0; i < array1.length; ++i) {
    if (array1[i] != array2[i]) {
        return false;
return true;
booleanarraysEqual(byte[] bytes, byte[] ints)
arrays Equal
if (bytes == null || ints == null) {
    return false;
if (bytes.length != ints.length) {
    return false;
for (int i = 0; i < bytes.length; i++) {
    if (bytes[i] != ints[i]) {
...
booleanarraysEqual(final Object[] a1, final Object[] a2)
Determines whether the two Object arrays are component-wise equal.
if (a1 == null || a2 == null)
    return a1 == null && a2 == null;
if (a1.length != a2.length)
    return false;
if (!a1.getClass().equals(a2.getClass()))
    return false;
if (a1.length == 0)
    return true;
...