File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/main/antora/modules/ROOT/pages/repositories Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,16 @@ 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());
15- do {
16-
14+ ScrollPosition position = ScrollPosition.offset();
15+ while (true) {
16+ users = repository.findFirst10ByLastnameOrderByFirstname("Doe", position);
17+ if (users.isEmpty()) break;
1718 for (User u : users) {
1819 // consume the user
1920 }
20-
21- // obtain the next Scroll
22- users = repository.findFirst10ByLastnameOrderByFirstname("Doe", users.positionAt(users.size() - 1));
23- } while (!users.isEmpty() && users.hasNext());
21+ if (!users.hasNext()) break;
22+ position = users.positionAt(users.size() - 1);
23+ }
2424----
2525
2626[NOTE]
You can’t perform that action at this time.
0 commit comments