I deep copied a list of objects into another list.
The problem is using .contains() didn’t work! Any ideas?
I deep copied a list of objects into another list. The problem is using
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.
In order for this to work you need to override hashcode and equals on the contents of the list. Contains uses these methods, which by default are based on the memory reference so it will only work for a shallow copy.