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,10 @@
|
||||
== id-based equals/hashCode, id assigned on save ==
|
||||
two unsaved entities equal? true (both ids null)
|
||||
set size after adding two different unsaved entities = 1
|
||||
add, then save(): set.contains(c) = false
|
||||
|
||||
== constant hashCode ==
|
||||
add, then save(): set.contains(d) = true
|
||||
|
||||
== natural key, immutable ==
|
||||
add, then save(): set.contains(e) = true
|
||||
Reference in New Issue
Block a user