Java Array Equal isEquals(char[] o1, char[] o2)

Here you can find the source of isEquals(char[] o1, char[] o2)

Description

Compare 2 arrays only at the first level

License

LGPL

Declaration

@Deprecated
public static boolean isEquals(char[] o1, char[] o2) 

Method Source Code

//package com.java2s;
/*//from www.j  a  v  a2s .c o  m
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */

public class Main {
    /**
     * Compare 2 arrays only at the first level
     *
     * @deprecated Use {@link java.util.Arrays#equals(Object[], Object[])} instead
     */
    @Deprecated
    public static boolean isEquals(Object[] o1, Object[] o2) {
        if (o1 == o2) {
            return true;
        }
        if (o1 == null || o2 == null) {
            return false;
        }
        int length = o1.length;
        if (length != o2.length) {
            return false;
        }
        for (int index = 0; index < length; index++) {
            if (!o1[index].equals(o2[index])) {
                return false;
            }
        }
        return true;
    }

    /**
     * Compare 2 arrays only at the first level
     *
     * @deprecated Use {@link java.util.Arrays#equals(char[], char[])} instead
     */
    @Deprecated
    public static boolean isEquals(char[] o1, char[] o2) {
        if (o1 == o2) {
            return true;
        }
        if (o1 == null || o2 == null) {
            return false;
        }
        int length = o1.length;
        if (length != o2.length) {
            return false;
        }
        for (int index = 0; index < length; index++) {
            if (!(o1[index] == o2[index])) {
                return false;
            }
        }
        return true;
    }

    /**
     * Compare 2 arrays only at the first level
     *
     * @deprecated Use {@link java.util.Arrays#equals(byte[], byte[])} instead
     */
    @Deprecated
    public static boolean isEquals(byte[] b1, byte[] b2) {
        if (b1 == b2) {
            return true;
        }
        if (b1 == null || b2 == null) {
            return false;
        }
        int length = b1.length;
        if (length != b2.length) {
            return false;
        }
        for (int index = 0; index < length; index++) {
            if (!(b1[index] == b2[index])) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. equalsToElement(final Object[] arr, final Object obj)
  2. equalStringArrays(String[] expected, String[] actual)
  3. findMinimaGreaterOrEqual(final int[] min, final int elt)
  4. getClosestIndexEqualToOrLargerThanGivenCoordinate(double[] coordinates, double coordinate)
  5. isEquals(byte[] id1, byte[] id2)
  6. isEquals(Object firstArray, Object secondArray)
  7. safeEquals(final byte[] obj1, final byte[] obj2)