wang3820 commented on PR #2096:
URL: https://github.com/apache/jena/pull/2096#issuecomment-1821166502

   > > How nondex works is that it shuffles collection objects that does not 
guarantee order, like `HashMap`, while running the test and see it fails 
because of some assumptions were made based on the order is maintained. From my 
understanding, since the variable ordering is retrieved from the `HashMap`, the 
returned injection order could be wrong.
   > 
   > So its actively shuffling the collection while the JVM is running, 
something that would **never** happen under normal circumstances?
   
   Yes, that is correct; however, while active shuffling of collections would 
never happen under normal circumstances, reordering of elements in a `HashMap` 
could happen. As it states in the 
[documentation](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html):
 "This class makes no guarantees as to the order of the map; in particular, it 
does not guarantee that the order will remain constant over time." However, as 
I understand, the probability of that happening is not high. The nondex tool 
simply significantly increase the chance. Since the insertion order really 
matters here, `LinkedHashMap` may be a better choice. 


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