hg: lambda/lambda/jdk: Tweak spec of trySplit, then ensuring spliterator from iterator
Paul Sandoz
paul.sandoz at oracle.com
Fri Apr 26 09:09:58 PDT 2013
On Apr 26, 2013, at 5:29 PM, Peter Levart <peter.levart at gmail.com> wrote:
> On 04/26/2013 05:01 PM, paul.sandoz at oracle.com wrote:
>> Changeset: f91091fa0cc3
>> Author: psandoz
>> Date: 2013-04-26 17:00 +0200
>> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/f91091fa0cc3
>>
>> Tweak spec of trySplit, then ensuring spliterator from iterator
>> implementations conform (a split can result in left hold all
>> elements and the right holding none).
>
> How can you determine when to stop splitting then and not fall into infinite loop?
>
We have to rely on spliterators being well-behaved where "repeated calls to {@code trySplit()} must eventually return {@code null}". This was always the case, since a spliterator could repeatedly return an estimated size of 0 (spliterators for hash map impls can do that).
I did ponder whether i should add more text stressing the "greater than", but decided to go for the terse option.
Paul.
More information about the lambda-dev
mailing list