Hi,
the API-specification for Set states:
Quote:
Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set).
So the Set's content is compared using object-identity, not the equals()-method.
contains() states this even clearer:
Quote:
More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)).
So you will only get equal Sets if obj == obj2, not if obj.equals(obj2).