Skip to content

Commit 5570a4e

Browse files
committed
FIX: start boundary condition for reverse lookup
1 parent bd59f3b commit 5570a4e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/main/java/org/archive/util/iterator/StartBoundedStringIterator.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ public String getNextInner() {
4040
}
4141
while(inner.hasNext()) {
4242
String tmp = inner.next();
43+
44+
boolean cond;
4345
int cmp = boundary.compareTo(tmp);
44-
if ((flip * cmp) > 0) {
45-
// System.out.format("Skipping: %s\n", tmp);
46+
47+
if (flip > 0) {
48+
cond = (cmp <= 0);
49+
} else {
50+
cond = ((cmp >= 0) || tmp.startsWith(boundary));
4651
}
47-
if ((boundary.compareTo(tmp) * flip) <= 0) {
52+
53+
if (cond) {
4854
started = true;
4955
return tmp;
5056
}

0 commit comments

Comments
 (0)