Java Object Equal objectsEqual(final Object objectA, final Object objectB)

Here you can find the source of objectsEqual(final Object objectA, final Object objectB)

Description

Compares two objects passed in for equality.

License

Open Source License

Parameter

Parameter Description
objectA one of the objects to be compared
objectB one of the objects to be compared

Declaration

public static boolean objectsEqual(final Object objectA, final Object objectB) 

Method Source Code

//package com.java2s;
/*/*from w w  w.java  2 s .  c  o  m*/
 *    Debrief - the Open Source Maritime Analysis Application
 *    http://debrief.info
 *
 *    (C) 2000-2014, PlanetMayo Ltd
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the Eclipse Public License v1.0
 *    (http://www.eclipse.org/legal/epl-v10.html)
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 */

public class Main {
    /**
     * Compares two objects passed in for equality.
     * Handle null objects.
     * @param objectA one of the objects to be compared
     * @param objectB one of the objects to be compared
     */
    public static boolean objectsEqual(final Object objectA, final Object objectB) {
        if (objectA == null)
            return (objectB == null);

        return objectA.equals(objectB);
    }
}

Related

  1. internalEquals(Object[] o1, Object[] o2)
  2. isEquals(final Object lhs, final Object rhs)
  3. isEquals(Object object1, Object object2)
  4. nullSafeEquals(Object o1, Object o2)
  5. nullSafeEquals(Object o1, Object o2)
  6. objectsEqual(Object a, Object b)
  7. objectsEqual(Object lhs, Object rhs)
  8. objectsEqual(Object o1, Object o2)
  9. objectsEqual(Object o1, Object o2)