Java Object Compare areEquals(final Object o1, final Object o2)

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

Description

Utility method for equals() methods.

License

Open Source License

Parameter

Parameter Description
o1 one object
o2 another object

Return

true if they're both null or both equal

Declaration

public static boolean areEquals(final Object o1, final Object o2) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  ww w.j ava2 s.co  m
     * Utility method for <code>equals()</code> methods.
     *
     * @param o1 one object
     * @param o2 another object
     *
     * @return <code>true</code> if they're both <code>null</code> or both equal
     */
    public static boolean areEquals(final Object o1, final Object o2) {
        return (o1 == o2) || (o1 != null && o1.equals(o2));
    }
}

Related

  1. areEqual(Object value1, Object value2)
  2. areEqual(T obj1, T obj2)
  3. areEqual(T obj1, V obj2)
  4. areEqualComparables(T object1, T object2)
  5. areEqualEvenIfBothNull(Object first, Object second)
  6. areEquals(Object a, Object b)
  7. areEquals(Object arg0, Object arg1)
  8. areEquals(Object... objs)
  9. areEqualsDirect(Object bean, Object other, Object... properties)