Spliterator

Paul Sandoz paul.sandoz at oracle.com
Thu Dec 20 01:14:28 PST 2012


On Dec 19, 2012, at 3:38 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> 
> Do you have any existing examples of Spliterators that
> return values other than 1/0? That might help.
> 

In the source code there is something called a SpinedBuffer that has better resizing characteristics than ArrayList but only supports addition of elements (no removal of).

SpinedBuffer holds an array of arrays (the spine), the size of individual arrays increases by some power of 2 as one goes down the spine.

A Spliterator, that has not been split, of SpinedBuffer returns N - 1 for the natural splits when N > 1, where N is the number of arrays in the spine.

Paul.


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