diff --git a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java index b9a442a0e..4d481c565 100644 --- a/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java +++ b/src/main/java/org/apache/commons/lang3/builder/DiffBuilder.java @@ -114,7 +114,7 @@ public class DiffBuilder implements Builder> { this.style = style; // Don't compare any fields if objects equal - this.objectsTriviallyEqual = testTriviallyEqual && (lhs == rhs || lhs.equals(rhs)); + this.objectsTriviallyEqual = testTriviallyEqual && Objects.equals(lhs, rhs); } /** @@ -814,7 +814,7 @@ public class DiffBuilder implements Builder> { } // Not array type - if (lhs != null && lhs.equals(rhs)) { + if (Objects.equals(lhs, rhs)) { return this; }