If every object added to a java.util.HashSet implements Object.equals() and Object.hashCode() in a deterministic fashion, is the iteration order over the HashSet guaranteed
Wanted to confirm / upvote earlier comments. In short, Do Not Rely on HashSet iteration in consistent order. This can and will introduce bugs in your system.
We just found and fixed a bug where the iteration order was inconsistent in HashSet even with:
And fixed it by using LinkedHashSet.
Thanks to the earlier posters :)