Wednesday, June 4, 2008 10:44 AM
A List will allow you to put duplicate data into the List... yes. This is because the only control over what goes into the list (if you are using Generics) is the object Type
of the list.
This doesn't mean your database is bad... You can have unique keys in the database that prevents duplicate data.
A List is just a container to hold ... well a List of things.
A Set is a specific type of collection that allows no duplicate. It does this by comparing 1) the object reference and 2) using the element1.equals(elemet2) method. If you haven't done a proper override of the equals method on you element, you might not get the results you want.
You database schema and indexing methods should prevent duplicates to the DB... Let the DB worry about that... It's MUCH faster than Java...