Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is meant by compatible equals() and hashCode() methods?

0
Posted

What is meant by compatible equals() and hashCode() methods?

0

Location: http://www.jguru.com/faq/view.jsp?EID=302746 Created: Jan 15, 2001 Modified: 2001-01-15 08:08:21.172 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) In order for the Java Collections to work properly (and everything else in Java), the equals() and hashCode() methods must be compatible. Here, compatible means that if equals() reports that two instances are the same, then the hashCode() of both instances must be the same value.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123