Remove duplicate elements from a collection

I responded with a similar idea when you mentioned this in another thread.