result.forEach(doc -> { ... })
Lazily iterate over a result set one element at a time.
RethinkDB results can be iterated through via the Java Iterable and Iterator interfaces; use standard Java commands like for
loops to access each item in the sequence.
Example: Let’s process all the elements!
try (Result<Object> result = r.table("users").run(conn)) {
result.forEach(doc -> { System.out.println(doc); });
}
Example: Stop the iteration prematurely.
try (Result<Object> result = r.table("users").run(conn)) {
for (Object doc: result) {
if (!processRow(doc)) {
break;
}
}
}
Couldn't find what you were looking for?
Contribute: edit this page or open an issue