Spliterator

Doug Lea dl at cs.oswego.edu
Thu Dec 20 07:29:22 PST 2012


On 12/20/12 10:15, Brian Goetz wrote:
>> But if the idea behind getNaturalSplits is to make it
>> easier to implement a crummy Spliterator than a good one,
>> then this adds to the reasons not to support this
>> method.
>
> I think the idea is more oriented around allowing people other than Doug to
> write (admittedly suboptimal) spliterators for data structures for which the
> optimal binary split is not obvious.

Which is still completely possible under isSplittable.
But if you cannot find a way to implement relatively balanced splits,
then you will  have to pay for it with more (annoying but easy)
bookkeeping that keeps track of how many times split has been
called. Which you'd have to track anyway. What could be better?

-Doug





More information about the lambda-libs-spec-observers mailing list