I noticed in the EJB 2.0
specification that most of the examples use java.util.Collection
when defining a relationship between two entities, even though java.util.Set is also allowed.
Why is that so?
I would expect java.util.Set
to be the most frequently used type, since in general you would not want
duplicates in a relationship. Think of a Person-owns-Car relationship for
instance – you are not interested in any duplicates here, since a Person
cannot own the same car twice so to speak (if one relationship says that person
P is the owner of car C, it does not provide you with any usefull
information to create yet another relationship between P and C).
do you use and why?
- RE: When to use java.util.Collection or java.util.Set Randahl Fink Isaksen