RFR(m): 8139233 add initial compact immutable collection implementations

Stuart Marks stuart.marks at oracle.com
Thu May 5 00:28:15 UTC 2016

On 5/4/16 6:22 AM, Alan Bateman wrote:
> This looks very good, but I just wonder about the iteration order varying from
> run to run in the Set/Map implementations. I recall the section added to the
> javadoc where it made it very clear that the iteration order is unspecified and
> subject to change and no issue with that. I'm just thinking about
> troubleshooting scenarios where it could make some issue harder to diagnose.

Hi Alan,

Yes, the unpredictability does introduce some risk of intermittent and 
hard-to-diagnose failures. On the other hand, the unspecified-but-mostly-stable 
iteration order we have with things like HashMap lets implicit order 
dependencies creep into code, which makes such failures even more rare and 
harder to diagnose. Plus, as hard as we try to make iteration order stable, 
there the times we make changes that do change the iteration order. Then, 
everything breaks.

The goal here is to expose code that uses these collections to more frequent 
order changes in order to "toughen" it up by flushing out inadvertent order 
dependencies. That way, we can change the implementation at will without 
worrying about changes to iteration order. We'll see if this works.

I can add an option to change the iteration order on every iteration, if you 
think that'll help. :-)


More information about the core-libs-dev mailing list