Here you can find the source of areEqual(Object object1, Object object2)
Parameter | Description |
---|---|
object1 | The first object to test for equality with the second object. |
object2 | The second object to test for equality with the first object. |
public static boolean areEqual(Object object1, Object object2)
//package com.java2s; /*//w w w. jav a2 s .com Copyright 2008 Jenkov Development Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Main { /** * Returns true if the two objects are either both null, or equal. If the * objects are both non-null equality is determined by the call * <code>object1.equals(object2)</code>. * @param object1 The first object to test for equality with the second object. * @param object2 The second object to test for equality with the first object. * @return True if the two objects are either both null, or equal. */ public static boolean areEqual(Object object1, Object object2) { if (object1 != null && object2 != null) return (object1.equals(object2)); else if (object1 == null && object2 != null) return false; else if (object1 != null && object2 == null) return false; return true; } }