Object is calculated based on the address, and the hashcode of String is calculated based on the internal char [].
mainly wants to ask why this method is overridden, and in which scenarios problems will occur if it is not rewritten
Object is calculated based on the address, and the hashcode of String is calculated based on the internal char [].
mainly wants to ask why this method is overridden, and in which scenarios problems will occur if it is not rewritten
basically all classes that might be used as keys for map should override hashcodewords! You should be surprised if you come across such a class without overriding equals and hashcode,.
Previous: How is the database of Q & A website designed?
Next: The cookie is the same after the CAPTCHA is refreshed, but the picture is different. Why?