ranking Sort Sort   |   date Sort Sort   |   member Sort Sort

Date Submitted Wed. Dec. 27th, 2006 9:40 AM
Revision 1
Scripter bertheymans
Tags Java | List | Set | uniqueness
Comments 2 comments
This is a very convenient way to remove all doubles from a List in Java. The only prerequisite is that the elements in the list have proper equals and hashCode methods.

It work by using the constructor of a Set that takes a Collection as an argument.

I poured the snippet in a little program so can run it straight away.