Remove duplicate elements from a collection

FWIW this recent thread may be relevant: Uniquing collections efficiently