Indeed, the JDK's Stream API doesn't offer any way to create chunks / substreams based on chunk sizes. Perhaps, you might find some appropriate abstraction in jOOλ https://github.com/jOOQ/jOOL
But really, an imperative approach based on the org.jooq.Cursor type might be the easiest way forward. fetchLazy() produces a Cursor but doesn't actually fetch anything yet. You can then call appropriate methods on the Cursor, including Cursor.fetchNext(int): https://www.jooq.org/javadoc/latest/org/jooq/Cursor.html#fetchNext-int- I hope this helps, Lukas 2018-03-13 17:55 GMT+01:00 LMey <lme...@excilys.com>: > Thank you. Alright so AFAIK, maybe besides fiddling with the spliterator, > there's no straightforward way of processing chunks from a stream. I guess > I'd better be off working with a Cursor directly. I've seen fetchLazy does > not accept a RecordMapper callback. Is there any way of using one when > lazily fetching ? I haven't seen anything in the doc and I'd like to avoid > a RecordN leaking from my repository. > -- 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 to jooq-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.