Java Utililty Methods Object Equal

List of utility methods to do Object Equal

Description

The list of methods to do Object Equal are organized into topic(s).

Method

booleanisEquals(Object object1, Object object2)
is Equals
if (object1 == object2) {
    return true;
if (object1 == null || object2 == null) {
    return false;
if (!object1.getClass().equals(object2.getClass())) {
    return false;
...
booleannullSafeEquals(Object o1, Object o2)
null Safe Equals
if (o1 == o2) {
    return true;
if (o1 == null || o2 == null) {
    return false;
if (o1.equals(o2)) {
    return true;
...
booleannullSafeEquals(Object o1, Object o2)
Determine if the given objects are equal, returning true if both are null or false if only one is null.
if (o1 == o2)
    return true;
if (o1 == null || o2 == null)
    return false;
if (o1.equals(o2))
    return true;
if (o1 instanceof Object[] && o2 instanceof Object[])
    return Arrays.equals((Object[]) o1, (Object[]) o2);
...
booleanobjectsEqual(final Object objectA, final Object objectB)
Compares two objects passed in for equality.
if (objectA == null)
    return (objectB == null);
return objectA.equals(objectB);
booleanobjectsEqual(Object a, Object b)
objects Equal
if ((a == null) && (b == null)) {
    return true;
if ((a == null) || (b == null)) {
    return false;
return a.toString().equals(b.toString());
booleanobjectsEqual(Object lhs, Object rhs)
Compare two objects in a null-safe manner.
return (lhs == null) ? (rhs == null) : lhs.equals(rhs);
booleanobjectsEqual(Object o1, Object o2)
Returns if two strings are equal.
if (o1 == null) {
    if (o2 == null)
        return true;
    else
        return false;
} else if (o2 == null)
    return false;
else
...
booleanobjectsEqual(Object o1, Object o2)
Simple null-safe equality check
return o1 == null ? o2 == null : o1.equals(o2);
booleanobjectsEqual(Object obj1, Object obj2)
objects Equal
if (obj1 == null) {
    return (obj2 == null);
} else {
    return obj1.equals(obj2);
booleanobjectsEqual(T a, T b)
Compares if two objects are equal, handling the cases where one of both of them may be null
return (a == b) || (a != null && a.equals(b));