When should this come to mind?
Remember membership without storing a separate associated value.
Duplicate detectionAlready visitedUnique values
What makes it work
Membership is expected O(1); storing k unique values takes O(k) space.
When to choose something else
If you need counts or indices, use a map instead.