Here you can find the source of objectsEqual(Object lhs, Object rhs)
Parameter | Description |
---|---|
lhs | The first object to compare. |
rhs | The second object to compare. |
public static boolean objectsEqual(Object lhs, Object rhs)
//package com.java2s; /************************************************************************************* * Copyright (c) 2011, 2012, 2013 James Talbut. * jim-emitters@spudsoft.co.uk// w w w . j av a 2 s .c o m * * 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: * James Talbut - Initial implementation. ************************************************************************************/ public class Main { /** * Compare two objects in a null-safe manner. * @param lhs * The first object to compare. * @param rhs * The second object to compare. * @return * true is both objects are null or lhs.equals(rhs), otherwise false. */ public static boolean objectsEqual(Object lhs, Object rhs) { return (lhs == null) ? (rhs == null) : lhs.equals(rhs); } }