Java Array Equal arraysEqual(Object[] array1, Object[] array2)

Here you can find the source of arraysEqual(Object[] array1, Object[] array2)

Description

arrays Equal

License

Apache License

Declaration

public static boolean arraysEqual(Object[] array1, Object[] array2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean arraysEqual(Object[] array1, Object[] array2) {
        if (array1.length != array2.length) {
            return false;
        }// w  w w. j  a  v  a2 s  . com

        for (int i = 0; i < array1.length; ++i) {
            if (!array1[i].equals(array2[i])) {
                return false;
            }
        }
        return true;
    }

    public static boolean arraysEqual(byte[] array1, byte[] 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. arraysAreEqual(Object value, Object otherValue)
  2. arraysEqual(boolean[] a, boolean[] b)
  3. arraysEqual(byte array1[], byte array2[])
  4. arraysEqual(byte[] bytes, byte[] ints)
  5. arraysEqual(final Object[] a1, final Object[] a2)
  6. arraysEqual(String[] arr1, String[] arr2)
  7. arraysEqual(String[] one, String[] other)
  8. arraysEquals(byte[] a, byte[] b)
  9. arraysEquals(byte[] a, int ofsA, byte[] b, int ofsB, int len)