I see that many examples use List for “many” relations, however, Set seems to better fulfil the role since lookup can happen in O(1) while the list search is O(N/2). Is there any reason why List is the preferred type to use?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check yourself, Ebean’s authors answered it already with details in article:
List Set Map or Collection?
You’ll find there a sumarized description of each type and also comparison between chosen types.