Skip to content

Commit f82b0ed

Browse files
cursoragentsimbo1905
andcommitted
Issue #128 Fix JsonPathRuntime slice lambdas
Co-authored-by: simbo1905 <simbo1905@60hertz.com>
1 parent 158fd12 commit f82b0ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

json-java21-jsonpath/src/main/java/json/java21/jsonpath/JsonPathRuntime.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,18 @@ static Stream<JsonValue> selectSlice(JsonValue v, Integer start, Integer end, In
5959
s = Math.max(0, Math.min(s, size));
6060
e = Math.max(0, Math.min(e, size));
6161

62-
return IntStream.iterate(s, i -> i < e, i -> i + actualStep)
62+
final int sFinal = s;
63+
final int eFinal = e;
64+
return IntStream.iterate(sFinal, i -> i < eFinal, i -> i + actualStep)
6365
.mapToObj(elements::get);
6466
}
6567

6668
int s = start != null ? normalizeIndex(start, size) : size - 1;
6769
final int e = end != null ? normalizeIndex(end, size) : -1;
6870
s = Math.max(0, Math.min(s, size - 1));
6971

70-
return IntStream.iterate(s, i -> i > e, i -> i + actualStep)
72+
final int sFinal = s;
73+
return IntStream.iterate(sFinal, i -> i > e, i -> i + actualStep)
7174
.mapToObj(elements::get);
7275
}
7376

0 commit comments

Comments
 (0)