Originally posted by Maulin, Vasavada:
[B]Hi,
I read that Set interface doesn't allow duplicates in it. So, why does the following code works without any erros?
Should not 'ts' object thrwo exception if i try to insert two objects that have equlas() method returning true?
Please throw some light on this.
Regards
Maulin.[/B]
Yes. Set wont accept duplicates. But it wont throw any compile/runtime errors.
add returns a boolean so it returns FALSE if try to duplicate a value.. If you check the size of 'ts' it will be 1..
HIH
Ragu