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

   Hi @mariofusco ,
   
   Thanks for the guidance! 
   
   > for 2 iterations of the same unchanged HashSet instance in the same JVM 
execution it is guaranteed that the iteration order will be the same
   
   Thanks for pointing this out. My previous assumption was incorrect. For this 
case, the 'relatively deterministic' of the 2 iterations is sufficient.
   
   ### For more context:
   
   I did some simple experiment 
https://github.com/TestingResearchIllinois/idoft/pull/1273#issuecomment-2415929519,
 and the reason that NonDex is making a 'false positive' for this case is 
because the two types of iterations being used: the Collection.forEach at 
[code](https://github.com/apache/incubator-kie-drools/blob/9711a149672bc6721288e9ec16374a5b42d4a97e/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/BoxedParameters.java#L47)
 and Stream.forEach at 
[code](https://github.com/apache/incubator-kie-drools/blob/9711a149672bc6721288e9ec16374a5b42d4a97e/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/generator/Consequence.java#L305).
 Inherently, they are using different implementations: Stream API is using 
Splitereator and the 'normal' Collections forEach is using Iterator.
   
   Right now NonDex is not shuffling Stream and caused the 'mismatch' between 
the two iterations during one execution in this particular case. 
   
   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)
   
   Any insights on this would be greatly appreciated!
   
   Sorry for the confusion to you earlier. I really appreciate the time you 
take in responding! 


-- 
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