Can we add Object as a key in HashMap? If yes then how?
Resposta da entrevista
Sigiloso
4 de abr. de 2021
Yes, But Class of the key Object must override both hashCode () and equals() methods. Custom class should follow the contract between hashCode() and equals().