Why use an immutable set if you're going to be clearing it repeatedly? Wouldn't a mutable set like a `HashSet` be better here? You could then simply `clear()` it, rather than creating a new object.