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

commit 1835a52a8e425eae88554195ac7db9212f57375b
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jun 23 14:19:07 2024 -0400

    Use if-else
---
 .../collections4/trie/AbstractPatriciaTrie.java    | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

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 ec50fa7ff..7506c3eac 100644
--- 
a/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
+++ 
b/src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java
@@ -774,12 +774,10 @@ public abstract class AbstractPatriciaTrie<K, V> extends 
AbstractBitwiseTrie<K,
             Map.Entry<K, V> e = null;
             if (fromKey == null) {
                 e = firstEntry();
+            } else if (fromInclusive) {
+                e = ceilingEntry(fromKey);
             } else {
-                if (fromInclusive) {
-                    e = ceilingEntry(fromKey);
-                } else {
-                    e = higherEntry(fromKey);
-                }
+                e = higherEntry(fromKey);
             }
 
             final K first = e != null ? e.getKey() : null;
@@ -814,12 +812,10 @@ public abstract class AbstractPatriciaTrie<K, V> extends 
AbstractBitwiseTrie<K,
             final Map.Entry<K, V> e;
             if (toKey == null) {
                 e = lastEntry();
+            } else if (toInclusive) {
+                e = floorEntry(toKey);
             } else {
-                if (toInclusive) {
-                    e = floorEntry(toKey);
-                } else {
-                    e = lowerEntry(toKey);
-                }
+                e = lowerEntry(toKey);
             }
 
             final K last = e != null ? e.getKey() : null;
@@ -2314,10 +2310,8 @@ public abstract class AbstractPatriciaTrie<K, V> extends 
AbstractBitwiseTrie<K,
             if (selectR(h.left, h.bitIndex, key, lengthInBits, reference)) {
                 return selectR(h.right, h.bitIndex, key, lengthInBits, 
reference);
             }
-        } else {
-            if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) {
-                return selectR(h.left, h.bitIndex, key, lengthInBits, 
reference);
-            }
+        } else if (selectR(h.right, h.bitIndex, key, lengthInBits, reference)) 
{
+            return selectR(h.left, h.bitIndex, key, lengthInBits, reference);
         }
         return false;
     }

Reply via email to