This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


The following commit(s) were added to refs/heads/master by this push:
     new 11eb27d  Raise embedded if into parent if.
11eb27d is described below

commit 11eb27dfb0cde14d81fb6c90ae4cbd82f4129743
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Feb 28 12:19:37 2021 -0500

    Raise embedded if into parent if.
---
 .../commons/collections4/sequence/SequencesComparator.java   | 12 ++++--------
 .../commons/collections4/trie/AbstractPatriciaTrie.java      | 12 ++++--------
 .../org/apache/commons/collections4/FactoryUtilsTest.java    | 12 ++++--------
 3 files changed, 12 insertions(+), 24 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
 
b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
index 4376b22..deca2cf 100644
--- 
a/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
+++ 
b/src/main/java/org/apache/commons/collections4/sequence/SequencesComparator.java
@@ -203,10 +203,8 @@ public class SequencesComparator<T> {
                     ++y;
                 }
                 // Second step
-                if (delta % 2 != 0 && delta - d <= k && k <= delta + d) {
-                    if (vUp[i-delta] <= vDown[i]) { // NOPMD
-                        return buildSnake(vUp[i-delta], k + start1 - start2, 
end1, end2);
-                    }
+                if ((delta % 2 != 0 && delta - d <= k && k <= delta + d) && 
(vUp[i-delta] <= vDown[i])) { // NOPMD
+                    return buildSnake(vUp[i-delta], k + start1 - start2, end1, 
end2);
                 }
             }
 
@@ -229,10 +227,8 @@ public class SequencesComparator<T> {
                     y--;
                 }
                 // Second step
-                if (delta % 2 == 0 && -d <= k && k <= d ) {
-                    if (vUp[i] <= vDown[i + delta]) { // NOPMD
-                        return buildSnake(vUp[i], k + start1 - start2, end1, 
end2);
-                    }
+                if ((delta % 2 == 0 && -d <= k && k <= d) && (vUp[i] <= 
vDown[i + delta])) { // NOPMD
+                    return buildSnake(vUp[i], k + start1 - start2, end1, end2);
                 }
             }
         }
diff --git 
a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java 
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
index f051243..92bb7a8 100644
--- 
a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
+++ 
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
@@ -172,14 +172,10 @@ abstract class AbstractPatriciaTrie<K, V> extends 
AbstractBitwiseTrie<K, V> {
                 }
                 return root.setKeyValue(key, value);
 
-            } else if (KeyAnalyzer.isEqualBitKey(bitIndex)) {
-                // This is a very special and rare case.
-
-                /* REPLACE OLD KEY+VALUE */
-                if (found != root) { // NOPMD
-                    incrementModCount();
-                    return found.setKeyValue(key, value);
-                }
+            } else /* REPLACE OLD KEY+VALUE */
+            if (KeyAnalyzer.isEqualBitKey(bitIndex) && found != root) { // 
NOPMD
+                incrementModCount();
+                return found.setKeyValue(key, value);
             }
         }
 
diff --git 
a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java 
b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
index 36ba76b..d5fa0cb 100644
--- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
@@ -164,10 +164,8 @@ public class FactoryUtilsTest {
         }
         @Override
         public boolean equals(final Object obj) {
-            if (obj instanceof Mock1) {
-                if (iVal == ((Mock1) obj).iVal) {
-                    return true;
-                }
+            if (obj instanceof Mock1 && (iVal == ((Mock1) obj).iVal)) {
+                return true;
             }
             return false;
         }
@@ -188,10 +186,8 @@ public class FactoryUtilsTest {
         }
         @Override
         public boolean equals(final Object obj) {
-            if (obj instanceof Mock2) {
-                if (iVal == ((Mock2) obj).iVal) {
-                    return true;
-                }
+            if (obj instanceof Mock2 && (iVal == ((Mock2) obj).iVal)) {
+                return true;
             }
             return false;
         }

Reply via email to