posted 17 years ago
Hi,
In the code you provided, the equals and hashCode method are not invoked as the Set you constructed is composed using String objects. Hence, only the String object's equals, hashCode methods would be invoked.
To illustrate the effect of your local equals and hashCode, you may create instances of the class that holds this code and then replace Strings everywhere in your code with this new class. You may optionally add print statements in equals and hashCode to verify that these methods are indeed invoked.
Thanks & Regards,<br />Chandramouli Ram