You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/07/25 12:25:48 UTC
(commons-lang) 15/17: Merge if statements with the same return value.
This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 76d957ee5e32d27cfce2453d779ef1e520fa8c53
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 25 08:15:05 2026 -0400
Merge if statements with the same return value.
---
.../commons/lang3/builder/CompareToBuilder.java | 55 +++++-----------------
1 file changed, 11 insertions(+), 44 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
index 2e64e1cb5..d78241fe0 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -438,10 +438,7 @@ private CompareToBuilder(final Builder builder) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final boolean lhs, final boolean rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs) {
@@ -468,10 +465,7 @@ public CompareToBuilder append(final boolean lhs, final boolean rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final boolean[] lhs, final boolean[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -524,10 +518,7 @@ public CompareToBuilder append(final byte lhs, final byte rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final byte[] lhs, final byte[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -580,10 +571,7 @@ public CompareToBuilder append(final char lhs, final char rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final char[] lhs, final char[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -641,10 +629,7 @@ public CompareToBuilder append(final double lhs, final double rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final double[] lhs, final double[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -702,10 +687,7 @@ public CompareToBuilder append(final float lhs, final float rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final float[] lhs, final float[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -758,10 +740,7 @@ public CompareToBuilder append(final int lhs, final int rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final int[] lhs, final int[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -814,10 +793,7 @@ public CompareToBuilder append(final long lhs, final long rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final long[] lhs, final long[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -887,10 +863,7 @@ public CompareToBuilder append(final Object lhs, final Object rhs) {
* @since 2.0
*/
public CompareToBuilder append(final Object lhs, final Object rhs, final Comparator<?> comparator) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -973,10 +946,7 @@ public CompareToBuilder append(final Object[] lhs, final Object[] rhs) {
* @since 2.0
*/
public CompareToBuilder append(final Object[] lhs, final Object[] rhs, final Comparator<?> comparator) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {
@@ -1029,10 +999,7 @@ public CompareToBuilder append(final short lhs, final short rhs) {
* @return {@code this} instance.
*/
public CompareToBuilder append(final short[] lhs, final short[] rhs) {
- if (comparison != 0) {
- return this;
- }
- if (lhs == rhs) {
+ if (comparison != 0 || lhs == rhs) {
return this;
}
if (lhs == null) {