Encounter order

Remi Forax forax at univ-mlv.fr
Thu Oct 25 13:50:48 PDT 2012


On 10/25/2012 10:45 PM, Brian Goetz wrote:
>>> void forEach(Block<? super T> block);
>>>
>>> This is only about side effects, so encounter order shouldn't enter
>>> into the calculation.  Elements are fed to the block in whatever order
>>> and thread they are available.
>> But do we guarantee the ordering of effects for sequential
>> implementation? Just curious about what would the JavaDoc say for this
>> method.
>
> Good question.  What do you think we should guarantee here?  (Its 
> pretty hard to imagine an implementation that doesn't do this, but 
> that's a different consideration.)  I do think it is reasonable for us 
> to say that the effects are predictable in serial and not predictable 
> in parallel -- this is different from the *result*.

PriorityQueue iterator already returns values in the order maintained by 
the priority queue.
So I think it's fine to just say the order should be predictable for the 
same jdk.

Rémi



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