I know why the last test fail (HashSet fail to see that it contains the object modified because it regroup first by hashcode during the initial add) but I dont know which principle(s) I am violating in this code.
I have few ideas but nothing sure. Does the Collection classes are intended to be use only with immutable objects?
Sorry if this topic have already been address. It s hard to find a relevent topic with those keywords.
[ September 23, 2006: Message edited by: Eric Janssens ]
From the API for Set: "Note: Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set."
"I'm not back." - Bill Harding, Twister
Joined: Sep 26, 2005
I had look the Collection and HashSet classes in the API but didnt take a look to the Set interface.
Thanks a lot!
subject: Which principle(s) in Collection (HashSet) am I violating ?