Hi Barry, why didn't i think of doing that
. But it helped, thanks.
To Anil and Chandra. Thank you for your replies.
But I was well aware that my compareTo() method had a bad implementation. What I wanted to point out was that the objects would be handled as being equal because of the compareTo() method while they are not according to the equals() method.
It was just something I didn't expect. Imagine a class Person with an id and name. When I have 2 different persons with the same name, i'm unable to put them both in a TreeSet ordered on name, cause they will be considered as not unique.
[ May 07, 2007: Message edited by: Jesse Custer ]