Spliterator.OfPrimitive

Paul Sandoz paul.sandoz at oracle.com
Mon May 6 09:56:48 PDT 2013


Hi,

Brian and I re-introduced a simpler form of Spliterator.OfPrimitive. 

  public interface OfPrimitive<T, T_CONS, T_SPL extends Spliterator.OfPrimitive<T, T_CONS, T_SPL>> extends Spliterator<T>

This enables more sharing of primitive-based spliterator code, for example:

  http://hg.openjdk.java.net/lambda/lambda/jdk/rev/fad441986ad6

This should also reduce the bloat of primitive-based concat spliterator implementations, if we choose to add concatenation of primitive-based streams.


We could go further and provide limits for the types declared by OfPrimitive:

- T extends PrimitiveWrapper<T>, and require Integer extends PrimitiveWrapper<Integer>

- T_CONS extends PrimitiveConsumer<T>, and require IntConsumer extends PrimitiveConsumer<Integer>

But i am inclined to leave it as is.

Thoughts?

Paul.




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