Why is the ArraySpliterator split from an IteratorSpliterator not IMMUTABLE?

John Rose john.r.rose at oracle.com
Thu Apr 25 18:17:16 PDT 2013

Spliterators.java is entertaining reading.  There is a trySplit method which has this line of code:

  a = new Object[n];

Buffering up a split into a flat array is an interesting decision; it feels like marshalling a call for a GPU by creating a flat data set.

I'm very curious about the design behind this choice of copying, but I want to ask a simple question first:

Why is the thing returned from trySplit, that wraps 'a', not marked IMMUTABLE?

Is this an oversight, or am I missing some subtlety about IMMUTABLE?

— John

More information about the lambda-dev mailing list