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

booleanarraysEqual(Object[] array1, Object[] array2)
arrays Equal
if (array1.length != array2.length) {
    return false;
for (int i = 0; i < array1.length; ++i) {
    if (!array1[i].equals(array2[i])) {
        return false;
return true;
booleanarraysEqual(String[] arr1, String[] arr2)
Match two arrays for equality
if (arr1 != null && arr2 == null) {
    return false;
if (arr1 == null && arr2 == null) {
    return true;
if (arr1 == null && arr2 != null) {
    return false;
...
booleanarraysEqual(String[] one, String[] other)
arrays Equal
if (one == null && other != null)
    return false;
if (one != null && other == null)
    return false;
if (one.length != other.length)
    return false;
for (int i = 0; i < one.length; i++) {
    if (!equalString(one[i], other[i]))
...
booleanarraysEquals(byte[] a, byte[] b)
arrays Equals
if (a.length != b.length) {
    return false;
return arraysEquals(a, 0, b, 0, a.length);
booleanarraysEquals(byte[] a, int ofsA, byte[] b, int ofsB, int len)
arrays Equals
int end = ofsA + len;
while (ofsA < end) {
    if (b[ofsB++] != a[ofsA++]) {
        return false;
return true;
booleanarraysEquals(byte[] arr1, int offset1, byte[] arr2, int offset2)
arrays Equals
if (arr1 == null || arr2 == null || offset1 < 0 || offset2 < 0
        || arr1.length - offset1 != arr2.length - offset2 || arr1.length - offset1 < 0
        || arr2.length - offset2 < 0) {
    return false;
boolean result = true;
for (int a = offset1; a < arr1.length; a++) {
    if (arr1[a + offset1] != arr2[a + offset2]) {
...
booleanarraysEquals(Object[] mThis, Object[] mThat)
arrays Equals
if (mThis.length == mThat.length) {
    for (int i = 0; i < mThis.length; i++) {
        if (!((mThis[i] == null) && (mThat[i] == null))) {
            if ((mThis[i] == null) || (mThat[i] == null) || (!mThis[i].equals(mThat[i]))) {
                return false;
    return true;
} else {
    return false;
booleanblobsAreEqual(byte[] blob1, byte[] blob2)
blobs Are Equal
return Arrays.equals(blob1, blob2);
booleanbytesAreEqual(byte[] b1, byte[] b2)
Compares two byte arrays returning true if they're equal in length and content false if they're not.
return Arrays.equals(b1, b2);
booleanequal(boolean[][] a, boolean[][] b)
equal
if (a.length != b.length)
    return false;
boolean r = true;
for (int i = 0; i < a.length; i++) {
    if (!Arrays.equals(a[i], b[i])) {
        r = false;
        break;
return r;