tag:blogger.com,1999:blog-27876765.post3383054662335388053..comments2024-03-20T13:37:39.909+01:00Comments on Day to day stuff: Breaking a Java HashSetErik van Oostenhttp://www.blogger.com/profile/15976519439979651010noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-27876765.post-64822805302408205672011-12-13T15:13:53.621+01:002011-12-13T15:13:53.621+01:00I know! (Our tester with 2 months of Java experien...I know! (Our tester with 2 months of Java experience didn't.)<br /><br />The surprising thing is that the set starts behaving inconsistently, but doesn't outright fail with exceptions.Erik van Oostenhttps://www.blogger.com/profile/15976519439979651010noreply@blogger.comtag:blogger.com,1999:blog-27876765.post-13621816784630356692011-12-13T14:04:10.467+01:002011-12-13T14:04:10.467+01:00The javadocs are actually quite clear about this:
...The javadocs are actually quite clear about this:<br /><br />"It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time."<br /><br />and:<br /><br />"Note that this implementation is not synchronized. If multiple threads access a hash set concurrently, and at least one of the threads modifies the set, it must be synchronized externally."<br /><br />http://docs.oracle.com/javase/6/docs/api/java/util/HashSet.htmlDaanhttp://stuq.nlnoreply@blogger.com