Override hashcode member variable changed, object in set cannot find
1. Use the Hashcode function of the object to determine the memory location initially, and if there is no storage object at that location, store the object in this
2, if the hash function directly calculated memory address space already has an object exists, will use the object's equals to determine whether the object is equal, if not equal the order to find the next free memory space, if the same object exists, the duplicate object cannot be stored in the set
When an object is stored in the HashSet collection, it is not possible to modify those fields in the object that participate in the hash value calculation, otherwise, the object's modified hash value is different, in which case, Even if the Contains method uses the object's current reference as a parameter to retrieve an object in conjunction with HashSet, it will also return the result of the object not found, which will also result in a memory leak by deleting the current object separately from the collection in the HashSet. The so-called memory leak means that an object is not reused, but it occupies memory space and is not released.
Java Memory leak scenarios