Java Utililty Methods Object Compare

List of utility methods to do Object Compare

Description

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

Method

booleanareEqual(Object o1, Object o2)
Does a generic object comparison where one or both of the objects could be null.
if (o1 == o2)
    return true;
else if (o1 == null || o2 == null)
    return false;
else
    return o1.equals(o2);
booleanareEqual(Object o1, Object o2)
Checks whether two objects are equal.
Object obj1 = nvl(o1, "");
Object obj2 = nvl(o2, "");
return obj1.equals(obj2);
booleanareEqual(Object o1, Object o2)
are Equal
return (o1 == o2) || (o1 != null && o2 != null && o1.equals(o2));
booleanareEqual(Object obj, Object obj2)
are Equal
if (obj == null) {
    return obj2 == null;
} else {
    return obj.equals(obj2);
booleanareEqual(Object obj1, Object obj2)
Tests whether two object references refer to equal objects.
if (obj1 == obj2) {
    return true;
} else if (obj1 == null || obj2 == null) {
    return false;
} else {
    return obj1.equals(obj2);
booleanareEqual(Object obj1, Object obj2)
are Equal
if ((obj1 == null) || (obj2 == null)) {
    if (obj1 != obj2) {
        return false;
} else if (!obj1.equals(obj2)) {
    return false;
return true;
...
booleanareEqual(Object obj1, Object obj2)
Returns true if the two specified objects are the same.
return (obj1 == obj2) || (obj1 == null ? false : obj1.equals(obj2));
booleanareEqual(Object object1, Object object2)
Returns true if the two objects are either both null, or equal.
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;
booleanareEqual(Object one, Object another)
Return true if one is equal to another.
boolean result = (one == null ? another == null : one.equals(another));
return result;
booleanareEqual(Object parameter, Object otherParameter)
are Equal
if (parameter == null && otherParameter == null)
    return true;
if (parameter != null && otherParameter == null)
    return false;
if (parameter == null && otherParameter != null)
    return false;
return parameter.equals(otherParameter);