I was just wondering if it was a good idea to override
hashCode for mutable collections. This would imply that if I insert such a collection into a
HashSet and then modify the collection, the
HashSet would no longer be able to find the collection. Does this imply that only immutable collections should override
hashCode, or is this a nuisance Java programmers simply live with?
You should override
hashCode if your class should act like it were a value type. This usually is not the case for collections.
(I don't really have much Java experience. This answer is based on C#.)