Java Array Deep Equal deepEquals(boolean[] array1, boolean[] array2)

Here you can find the source of deepEquals(boolean[] array1, boolean[] array2)

Description

Compares the two boolean arrays deeply

License

Open Source License

Parameter

Parameter Description
array1 a parameter
array2 a parameter

Return

false if arrays have different length or different values at a specific index, true otherwise

Declaration

public static boolean deepEquals(boolean[] array1, boolean[] array2) 

Method Source Code

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

public class Main {
    /**/* w ww  .  j a  v  a2  s .  co  m*/
     * Compares the two boolean arrays deeply
     * @param array1
     * @param array2
     * @return false if arrays have different length or different values at a specific index,
     * true otherwise
     */
    public static boolean deepEquals(boolean[] array1, boolean[] array2) {
        if (array1.length != array2.length)
            return false;
        for (int i = 0; i < array1.length; i++) {
            if (!(array1[i] == array2[i]))
                return false;
        }
        return true;
    }
}

Related

  1. deepEquals(Object[] a1, Object[] a2)
  2. deepEquals(Object[] a1, Object[] a2)
  3. deepEquals(Object[] a1, Object[] a2)