Conny Lundgren

On Agile, Development, Mac, Technology and life in general.

Remove Duplicates

| Comments

I read a nice post about removing duplicates from a list, I must say that im stunned that i didn’t think about it. It’s so dead simple.

I post here so I can find it the next time I might need such a little trick :)

public List removeDuplicates(List items) { Set set = new LinkedHashSet(); set.addAll(items); return new ArrayList(set); }

Comments