From 53bb929c8f840a279f16cace5ce9567bb02a87aa Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 16 Jul 2023 16:26:59 -0400 Subject: [PATCH] Use Objects.equals() --- .../java/org/apache/commons/lang3/builder/DiffBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }