It's easy to explain.

A "jOOQ Stream" is really just a wrapper around a "jOOQ Cursor" with some
convenient API.
A "jOOQ Cursor" is really just an Iterator wrapper around a JDBC ResultSet
with some convenient API.

Now, every time a "jOOQ Stream" or a "jOOQ Cursor" pulls another value from
the underlying JDBC ResultSet, there is some JDBC action going on. This
directly translates to all terminal stream operations in their natural way.

To answer your question: Like any call to collect(), a call to collect() on
a "jOOQ Stream" will iterate the entire ResultSet and collect stuff, just
like a call to forEach() will iterate the entire ResultSet and do stuff
with each row.

Hope this helps,

2018-03-13 16:24 GMT+01:00 LMey <>:

> Of course. Just one last question regarding Jooq if you don't mind.
> With a Cursor I can understand how it works... Like, it maintains an open
> ResultSet and you can fetch X records in a loop, do stuff with them and
> repeat. But how does Jooq handles that with a stream ? Is it abstracted ?
> You said it won't load everything into memory in my example using a
> forEach, but is it the case for all terminal stream operations ? Surely if
> I collect or sorted it will load everything right ?

You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to