I programmed a 'collection' ADT. For the implementation of my collection I used a HashSet (with an iterator) because the kind of collection I
programmed, has no structure in ordening. My teammate is convinced that a collection better can be implemented with an arraylist. And my question is: In this case, is there anything I missed with the implemention of a collection with a hashset?
I hope a more advanced programmer, then myself, can review this problem...
I'm not advanced in this regard, but I believe that if your collection will not allow duplicates, and the items held in the collection have well defined and behaved hashCode and equals methods, then a HashSet is fine. An ArrayList is good if you want a collection that allows duplicates and where you want code that is optimized to obtain items in a random access way and by an index.