The difference is that adding must be type-safe to preserve the integrity of the collection, while item checking/removal can afford to be "type-forgiving" without the risk of harming type safety of the collection. In other words, if you add an element of a wrong type, the set will become invalid; on the other hand, if you check for a presence of an element of a wrong type, you'll simply get back a false
. Same goes for remove
: if you pass an element of an incompatible type, it's not going to be in the set +, so the removal is going to be a no-op.
+ Unless you put it in through a hack that exploits type erasure.