Java Object Compare areEqual(Object obj1, Object obj2)

Here you can find the source of areEqual(Object obj1, Object obj2)

Description

Returns true if the two specified objects are the same.

License

Open Source License

Declaration


public static boolean areEqual(Object obj1, Object obj2) 

Method Source Code

//package com.java2s;
/**// w w  w. j a v  a  2 s  . c om
 * The utillib library.
 * More information is available at http://www.jinchess.com/.
 * Copyright (C) 2002, 2003 Alexander Maryanovsky.
 * All rights reserved.
 *
 * The utillib library is free software; you can redistribute
 * it and/or modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * The utillib 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.  See the GNU Lesser
 * General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with utillib library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
 */

public class Main {
    /**
     * Returns <code>true</code> if the two specified objects are the same.
     * Returns <code>false</code> otherwise. To be considered the same, the two
     * references must either both be null or invoking <code>equals</code> on one
     * of them with the other must return <code>true</code>.
     */

    public static boolean areEqual(Object obj1, Object obj2) {
        return (obj1 == obj2) || (obj1 == null ? false : obj1.equals(obj2));
    }
}

Related

  1. areEqual(Object o1, Object o2)
  2. areEqual(Object o1, Object o2)
  3. areEqual(Object obj, Object obj2)
  4. areEqual(Object obj1, Object obj2)
  5. areEqual(Object obj1, Object obj2)
  6. areEqual(Object object1, Object object2)
  7. areEqual(Object one, Object another)
  8. areEqual(Object parameter, Object otherParameter)
  9. areEqual(Object value, Object otherValue)