Java Array Equal equal(boolean[][] a, boolean[][] b)

Here you can find the source of equal(boolean[][] a, boolean[][] b)

Description

equal

License

Open Source License

Declaration

public static boolean equal(boolean[][] a, boolean[][] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    public static boolean equal(boolean[][] a, boolean[][] b) {
        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;//w  ww.  j  av a  2 s .c o m
                break;
            }
        }
        return r;
    }

    public static boolean equal(int[][] a, int[][] b) {
        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;
    }

    public static boolean equal(double[][] a, double[][] b) {
        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;
    }
}

Related

  1. arraysEquals(byte[] a, int ofsA, byte[] b, int ofsB, int len)
  2. arraysEquals(byte[] arr1, int offset1, byte[] arr2, int offset2)
  3. arraysEquals(Object[] mThis, Object[] mThat)
  4. blobsAreEqual(byte[] blob1, byte[] blob2)
  5. bytesAreEqual(byte[] b1, byte[] b2)
  6. equal(byte[] a, byte[] b)
  7. equal(float[][] array1, float[][] array2)
  8. equal(int[] a, int[] b)
  9. equalByRows(boolean[][] a, boolean[][] b)