Java Array Compare arrayContentsEq(Object[] a1, Object[] a2)

Here you can find the source of arrayContentsEq(Object[] a1, Object[] a2)

Description

array Contents Eq

License

Apache License

Declaration

private static boolean arrayContentsEq(Object[] a1, Object[] a2) 

Method Source Code

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

public class Main {
    private static boolean arrayContentsEq(Object[] a1, Object[] a2) {
        if (a1 == null) {
            return a2 == null || a2.length == 0;
        }/*from   w w  w . j  a v a  2 s .c o m*/

        if (a2 == null) {
            return a1.length == 0;
        }

        if (a1.length != a2.length) {
            return false;
        }

        for (int i = 0; i < a1.length; i++) {
            if (a1[i] != a2[i]) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. arrayCompare(byte[] a1, byte[] a2)
  2. arrayCompare(byte[] b1, byte[] b2)
  3. arrayCompare(final T[] a, final T[] b)
  4. arrayCompare(int[] arr1, int[] arr2)
  5. arrayCompareLex(byte[] a, byte[] b)
  6. createStainMask(float[] redOD, float[] greenOD, float[] blueOD, double stainThreshold, boolean excludeGray, boolean excludeUncommonColors, boolean[] mask)
  7. getLongestCommonSubsequence(int[] a, int[] b)
  8. getRelativeSegments(String[] targetPath, int commonSegments, int discardedSegments)
  9. longestCommonPrefix(String[] stringArray)