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:
@@ -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
|
||||
Reference in New Issue
Block a user