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

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

Description

equal By Rows

License

Open Source License

Declaration

public static boolean equalByRows(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 equalByRows(boolean[][] a, boolean[][] b) {
        if (a.length != b.length)
            return false;
        boolean eqRow;
        boolean[] bUsed = new boolean[b.length];
        Arrays.fill(bUsed, false);
        for (int i = 0; i < a.length; i++) {
            eqRow = false;//  w  ww. j  a va 2 s  .c  om
            for (int j = 0; j < b.length; j++) {
                if (!bUsed[j]) {
                    if (Arrays.equals(a[i], b[j])) {
                        eqRow = true;
                        bUsed[j] = true;
                        break;
                    }
                }
            }
            if (!eqRow)
                return false;
        }

        return true;
    }
}

Related

  1. bytesAreEqual(byte[] b1, byte[] b2)
  2. equal(boolean[][] a, boolean[][] b)
  3. equal(byte[] a, byte[] b)
  4. equal(float[][] array1, float[][] array2)
  5. equal(int[] a, int[] b)
  6. equalFreqBinning(double[][] sampleData, int numPredVals, int numRespVals, int divInd)
  7. equalIgnoreOrder(final Object[] array1, final Object[] array2)
  8. equalityCheck(byte[] a, byte[] b)
  9. equalMaps(Map expected, Map actual)