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(byte[] left, byte[] right)
byte array compare
if (left == null) {
    return ((right == null) ? true : false);
if (right == null) {
    return ((left == null) ? true : false);
if (left.length != right.length)
    return false;
...
booleanarrayEquals(int[] a1, int[] a2)
Checks whether the two passed in arrays are equal.
if (a1 == a2) {
    return true;
} else if (a1 == null || a2 == null) {
    return false;
} else if (a1.length != a2.length) {
    return false;
} else {
    for (int i = 0; i < a1.length; i++) {
...
booleanarrayEquals(int[] arr1, int[] arr2)
array Equals
boolean result = true;
if (arr1.length != arr2.length)
    result = false;
else {
    for (int i = 0; i < arr1.length; i++)
        if (arr1[i] != arr2[i])
            result = false;
return result;
booleanarrayEquals(Object[] a, Object[] b)
array Equals
if (a == null || b == null) {
    return a == null && b == null;
if (a.length != b.length) {
    return false;
for (int i = 0; i < a.length; i++)
    if (!objEquals(a[i], b[i]))
...
booleanarrayEquals(Object[] a, Object[] b)
Compare two arrays of objects for equality.
if (a == null) {
    return b == null;
if (b == null) {
    return false;
if (a.length != b.length) {
    return false;
...
booleanarrayEquals(Object[] arr1, Object[] arr2)
array Equals
if (arr1 == null && arr2 == null)
    return true;
if (arr1 == null ^ arr2 == null)
    return false;
if (!arr1.getClass().equals(arr2.getClass()))
    return false;
if (arr1.length != arr2.length)
    return false;
...
booleanarrayEquals(Object[] array1, Object[] array2)
array Equals
if (array1.length != array2.length) {
    return false;
for (int i = 0; i < array1.length; i++) {
    if (!equals(array1[i], array2[i])) {
        return false;
return true;
booleanarrayEquals(Object[] source, Object target)
Convenience utility to compare two Object[]s.
if (source == null)
    return (target == null);
if (!(target instanceof Object[]))
    return false;
Object[] targ = (Object[]) target;
return (source.length == targ.length && arrayRegionMatches(source, 0, targ, 0, source.length));
booleanarrayEquals(Object[] source, Object target)
Convenience utility to compare two Object[]s.
if (source == null)
    return (target == null);
if (!(target instanceof Object[]))
    return false;
Object[] targ = (Object[]) target;
return (source.length == targ.length && arrayRegionMatches(source, 0, targ, 0, source.length));
booleanarrayEquals(String[] array1, String[] array2)
array Equals
if (array1.length != array2.length) {
    System.err.println("Not equal lengths: " + array1.length + "/" + array2.length);
    return false;
for (int i = 0; i < array1.length; i++) {
    if (!(array1[i].equals(array2[i]))) {
        System.err.println("Not equal: " + array1 + "/" + array2);
        return false;
...