On Fri, Aug 16, 2019 at 12:43 AM Knut Wannheden <[email protected]> wrote:
> On Thu, Aug 15, 2019 at 6:52 PM Nathaniel Mishkin <[email protected]> > wrote: > >> Unfortunately, the logic of what I'm trying to do requires the *limit()* to >> be after the *window()*. >> > > What I meant was that you could call limit() before *and* after calling > window(). The first call to limit() would have to account for the window > size. So instead of calling seq.window(-1, 1).limit(10) you would call > seq.limit(11).window(-1, 1).limit(10). Hope this makes more sense now. > Ah, yes, thanks. I *might* be able to make this work but the problem is that the pipeline I want has a downstream *filter()*. I.e., I want something like: seq.window(-1, 1).map(...).filter(...).limit(...) If I make this be: seq.limit(...).window(-1, 1).map(...).filter(...).limit(...) it's possible the result of the second *limit()* will be a sequence that's shorter than the sequence produced by the original pipeline (the one without two *limit()*s). In the worst case, the sequence might be of zero length which, if I don't add some compensating code, could be misunderstood to mean that the originating source of data for the stream (a DB cursor wrapped in an iterator, in my case) has been fully drained. Maybe I could put the code in a loop and use a *.hasNext()* on the iterator as the loop condition. (Maybe. I love the whole stream paradigm and think it has a lot of value but it's sort of the case that if you think about things either too much or too little you can get really confused :-) Any update on this? Did Lukas have a good vacation? :-) >> > > No update yet. But he is indeed back from his vacation, so we should get > back to you soon regarding this. > Thanks. Nat -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAN0fKj0Xui6Hu7o7kF-F%3DWqExuRcpFmbJA1fg4oJOcYMim3m9A%40mail.gmail.com.
