On Mon, Jun 15, 2015 at 10:16 AM, Paul Sandoz <paul.san...@oracle.com> wrote:
> On Jun 15, 2015, at 6:34 PM, Martin Buchholz <marti...@google.com> wrote: > > Staring at LinkedTransferQueue.java, I see: > > > > return Spliterators.spliterator > > (a, 0, i, (Spliterator.ORDERED | > > Spliterator.NONNULL | > > Spliterator.CONCURRENT)); > > > > but ... that's a spliterator over an immutable array, so shouldn't we > have IMMUTABLE instead of CONCURRENT? > > > > The intent here is that the sub-spliterators "inherit" certain > characteristics of their top-level spliterator or source, It makes sense for some characteristics to be inherited, like NONNULL. > rather than from that which might be derived from an internal data > structure used to hold a partitioned set of elements. > > Note that the specification of Spliterator.CONCURRENT allows for > sub-spliterators to report SIZED/SUBSIZED. > How is SIZED/SUBSIZED different from IMMUTABLE ? They both describe internal data structures, so yeah ... there is some kind of leak of implementation details, but these characteristics are there to be used by clients, so shouldn't we try to make them accurate? Alternatively: currently some spliterator characteristics describe "this" spliterator, and some describe the "parent", which is very confusing.