mariofusco commented on PR #6119:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6119#issuecomment-2420108837

   > However, after reading some online posts and Javadoc for Stream API, I 
still have one unresolved question: **should we expect `Spliterator` and 
`Iterator` to return elements in the same order during a single execution?** 
(There was a issue reported here against the order of Stream.forEach but seems 
not exactly the same: https://bz.apache.org/netbeans/show_bug.cgi?id=257129)
   
   That's a really good question (to which I wasn't actually thinking) and the 
short answer is that I don't know. 
   
   In general if a behaviour is not clearly stated in the contract of an API I 
assume that I cannot rely on it. However in this specific case I'd be very 
surprised if the `Iterator` and the single threaded `Spliterator` had a 
different iteration order: the goal of the `Spliterator` is recursively 
splitting a collection in chunks and the iterating any chunk independently, but 
if it doesn't perform any split (which is the case of the sequential execution) 
I don't see why the iteration order should be different by a normal `Iterator`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to