Throwing is surprising to me - I'd expect adding something to a set to add it if it doesn't exist already and otherwise do nothing.