This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
HashSet use equals() and hashCode() methods to check the duplicates and follow the natural order.
Hello Matloob, the above statement ia PARTIALLY correct, what I mean is that HashSet 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.
If you have any doubts, you can consult the API .
And for the purpose of the exams, if you find any questions that ask about the result of a HashSet order, you will find options like "output depends on Hashing" or "Output Not Definded" etc, thats the correct answer, do NOT try to check for ordering. (SAME Applies to numbers AND Strings).
In Your Pursuit Towards Certification, NEVER Give Up.