Use an OrderedSet, only insert new elements, collect when done.
also preserves order AFAIK and has a cool API to avoid hash table lookups twice.
Use an OrderedSet, only insert new elements, collect when done.
also preserves order AFAIK and has a cool API to avoid hash table lookups twice.