Detecting change of a name or a part
A good option is to use the Objects utility class (available since Java 7)

Note also, that instead of doing if-conditions and returning true, or false, you can do a direct return of the condition... For example, the part == null is common to these two expressions:


if (part == null &amp;&amp; newName == null) {
    return false;
}
if (part == null || newName == null) {
    return true;
}



And those can be simplified to just:

if (part == null) {
    return newName != null;
}


Note also, that your code runs the risk of a NullPointerException if part.getName() returns null. Is that possible?

Your code:


private boolean isThingChanged(String newName, Thing thing) {
    final Part part = thing.getPart();
    if (part == null &amp;&amp; newName == null) {
        return false;
    }
    if (part == null || newName == null) {
        return true;
    }
    return !part.getName().equals(newName);
}



Could be:

private boolean isThingChanged(String newName, Thing thing) {
    if (thing.getPart() == null) {
        return newName != null;
    }
    return !Objects.equal(thing.getPart().getName(), newName);
}


Writing that as a ternary is an option:

private boolean isThingChanged(String newName, Thing thing) {
    return thing.getPart() == null ? newName != null : !Objects.equal(thing.getPart().getName(), newName);
}