Java Arena

Module 32

Comparing objects: equals and hashCode

Objects of your own classes as the keys of a hash map. equals again, and why a HashMap can't find a key that's made again with the same values, what a hash code is and the rule that ties it to equals, writing hashCode by hand and with Objects.hash, equality that ignores some values or capital letters, and a small program with objects as keys, printed in an order you choose. MOOC section 8.3.

Steps

  1. equals, again
  2. What a hash code is
  3. Writing hashCode
  4. Equal enough: ignoring some values or capitals
  5. Objects as keys in practice