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 extends AbstractBitwiseTrie 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 extends AbstractBitwiseTrie 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 extends AbstractBitwiseTrie