Java Object Compare areEqual(final Object x, final Object y)

Here you can find the source of areEqual(final Object x, final Object y)

Description

Returns true if the given objects are equal, namely, they are both null or they are equal by the equals() method.

License

Open Source License

Parameter

Parameter Description
x the first compared object.
y the second compared object.

Return

true if the given objects are equal.

Declaration

public static boolean areEqual(final Object x, final Object y) 

Method Source Code

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

public class Main {
    /**/*  www. j  a  va  2 s  .  c o m*/
     * Returns true if the given objects are equal, namely, they are both null or they are equal by the {@code equals()} method.
     *
     * @param x the first compared object.
     * @param y the second compared object.
     *
     * @return true if the given objects are equal.
     */
    public static boolean areEqual(final Object x, final Object y) {
        return x == null ? y == null : x.equals(y);
    }
}

Related

  1. areEqual(final Object first, final Object second)
  2. areEqual(final Object o1, final Object o2)
  3. areEqual(final Object object0, final Object object1)
  4. areEqual(final T object1, final T object2)
  5. areEqual(Object aThis, Object aThat)
  6. areEqual(Object first, Object second)
  7. areEqual(Object first, Object second, boolean equalEvenIfBothNull)