Characteristics of an empty spliterator

David Holmes david.holmes at oracle.com
Tue Mar 26 04:03:56 PDT 2013


Hi Dmitry,

On 26/03/2013 8:55 PM, Dmitry Bessonov wrote:
> I wonder what are the expected characteristics of empty spliterators?
> Having SIZED and not having INFINITE is logical.
>
> What about SUBSIZED characteristic
> which the current implementation gives to an empty spliterator?
>
>       /**
>        * Characteristic value signifying that this, and all Spliterators
>        * resulting from {@code trySplit()}, as well as any that they in
>        * turn split, are {@link #SIZED}.  .......
>        */
>       public static final int SUBSIZED = 0x00010000;
>
> Current behavior of method trySplit() of an empty spliterator
> indicates that it could not be ever split.
> So this seems like a spec contradiction.

I don't see a contradiction. Seems like an arbitrary choice as to 
whether an empty spliterator is SUBSIZED given that there can be no 
sub-spliterators.

David

>
> May it make sense to specify characteristics of an empty spliterator
> explicitly?
>
> -Dmitry
>
>


More information about the lambda-dev mailing list