Java 6 Collections: Why need HashSet
If the ordering of the elements is not important, then the Hash set allows you to find the element much faster. But anyway, if you access these elements in the iterative manner, you may get random ordering each time. The well known data structure for finding objects quickly is the hash table. Java HashSet and HashTable are based on the hash table data structure. Specially, if the universe U is larger, it is impractical to storing objects in the Table T which is size of U . Instead Key can represent the actual object because K is relatively smaller compared to associated object. The storage requirement is Θ( K ) and to search a element in the hash table required only Ο(1) time. In the direct addressing such as ArrayList, an element is stored is referenced in the k slot of the table, instead hashing, this element is stored in slot h(k) for the hash function h . In other words, k 3 an k 10 can be in the same slot. If two keys are fallen to a same slot which is called hash...