To Stream.slice(fromInclusive, toExclusive) or Stream.slice(toSkip, limit) that is the question
paul.sandoz at oracle.com
Mon Oct 14 05:03:19 PDT 2013
On Oct 11, 2013, at 10:12 PM, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:
> Thanks for the example.
> In terms of readability, I think skip(offset).limit(size) works well in
> this case.
> I think slice(offset, offset+size) works fine here, as well.
> By the way, slice(start, end) has another potential advantage in that
> negative values for the 'end' argument can be interpreted as an offset from
> the end -- skipping the final x entries.
Although that only works best for sized/subsized pipelines. Stick a filter op in front and it is necessary to buffer everything for both sequential and parallel pipelines.
My preference would be to drop this method.
More information about the lambda-libs-spec-experts