Skip to content

Commit a0ac40f

Browse files
authored
Fix the scrolling example code error
Signed-off-by: r6hk <[email protected]>
1 parent 6ac5cf8 commit a0ac40f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/antora/modules/ROOT/pages/repositories/scrolling.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ Similar to consuming a Java `Iterator<List<…>>` by obtaining the next batch of
1111

1212
[source,java]
1313
----
14-
Window<User> users = repository.findFirst10ByLastnameOrderByFirstname("Doe", ScrollPosition.offset());
14+
ScrollPosition position = ScrollPosition.offset();
15+
Window<User> users;
1516
do {
16-
17-
for (User u : users) {
18-
// consume the user
19-
}
20-
21-
// obtain the next Scroll
22-
users = repository.findFirst10ByLastnameOrderByFirstname("Doe", users.positionAt(users.size() - 1));
17+
users = repository.findFirst10ByLastnameOrderByFirstname("Doe", position);
18+
for (User u : users) {
19+
// consume the user
20+
}
21+
// update the position
22+
position = users.positionAt(users.size() - 1);
2323
} while (!users.isEmpty() && users.hasNext());
2424
----
2525

0 commit comments

Comments
 (0)