Java Object Compare areEqual(Object o1, Object o2)

Here you can find the source of areEqual(Object o1, Object o2)

Description

are Equal

License

Open Source License

Parameter

Parameter Description
o1 a parameter
o2 a parameter

Return

true either if both objects are null or if they are equal

Declaration

public static boolean areEqual(Object o1, Object o2) 

Method Source Code

//package com.java2s;
/******************************************************************************
 * Copyright (c) 2013, Linagora//  w  ww . j  a va 2  s .c  om
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *       Linagora - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * @param o1
     * @param o2
     * @return true either if both objects are null or if they are equal
     */
    public static boolean areEqual(Object o1, Object o2) {
        return o1 == null ? o2 == null : o1.equals(o2);
    }
}

Related

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