Java Object Equal isEquals(final Object lhs, final Object rhs)

Here you can find the source of isEquals(final Object lhs, final Object rhs)

Description

is Equals

License

Open Source License

Declaration

public static boolean isEquals(final Object lhs, final Object rhs) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static boolean isEquals(final Object lhs, final Object rhs) {
        if (!lhs.getClass().isArray()) {
            return lhs.equals(rhs);
        } else if (lhs instanceof int[]) {
            return Arrays.equals((int[]) lhs, (int[]) rhs);
        } else if (lhs instanceof long[]) {
            return Arrays.equals((long[]) lhs, (long[]) rhs);
        } else if (lhs instanceof byte[]) {
            return Arrays.equals((byte[]) lhs, (byte[]) rhs);
        } else if (lhs instanceof short[]) {
            return Arrays.equals((short[]) lhs, (short[]) rhs);
        } else if (lhs instanceof char[]) {
            return Arrays.equals((char[]) lhs, (char[]) rhs);
        } else if (lhs instanceof double[]) {
            return Arrays.equals((double[]) lhs, (double[]) rhs);
        } else if (lhs instanceof float[]) {
            return Arrays.equals((float[]) lhs, (float[]) rhs);
        } else if (lhs instanceof boolean[]) {
            return Arrays.equals((boolean[]) lhs, (boolean[]) rhs);
        } else {//from   ww w.j  a v a  2s. c o  m
            return Arrays.equals((Object[]) lhs, (Object[]) rhs);
        }
    }
}

Related

  1. equals(Object thisObj, Object thatObj)
  2. equals(Object v1, Object v2)
  3. equals(Object x, Object y)
  4. equals(Object... objects)
  5. internalEquals(Object[] o1, Object[] o2)
  6. isEquals(Object object1, Object object2)
  7. nullSafeEquals(Object o1, Object o2)
  8. nullSafeEquals(Object o1, Object o2)
  9. objectsEqual(final Object objectA, final Object objectB)