Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

finding duplicates in arraylist by using contains method

843789Sep 24 2009 — edited Sep 24 2009
How can I find the duplicates in an arraylist by using the contains method? then I need to store every duplicate in another arraylist so lets say my arraylist is
<1,2,2,3,3,2,1,3,4,5>
so I need to find the duplicates which are 1,2 and 3 and store those duplicates in another arraylist so this arraylist will be something like this <1,2,3>
and I have to do these by using the contains method for arraylists. I know I need to override the equals method. Any help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2009
Added on Sep 24 2009
15 comments
2,796 views