equals-hashcode: equals/hashCode contract demos, missing hashCode and constant-hash costs, mutable keys, records, JPA entity id trap, 13 contract tests

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b66uwsWr9B1ouyrzUh
This commit is contained in:
Claude
2026-11-12 20:08:35 +05:30
parent 319697c345
commit 682b7b067c
22 changed files with 692 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
before: get = 100, contains = true
after acc.owner = "ankur":
map.get(acc) = null
set.contains(acc) = false
map.containsKey(acc) = false
map.size() = 1
iteration still sees it = [Account(ankur)]
map.remove(acc) = null
map.size() after remove = 1
set.add(acc) again -> size = 2 [Account(ankur), Account(ankur)] (one object, two entries)
immutable key: map.get("asha") = 1