Files
java-core-examples/equals-hashcode/output/05-records.txt
T

24 lines
757 B
Plaintext

== generated equals/hashCode ==
a.equals(b) = true
a.hashCode() == b.hashCode() = true
new HashSet of both, size = 1
a == b = false
== array component: reference equality ==
w1.equals(w2) = false
same array shared: true
== mutable List component: equals works, hashCode can change ==
hashCode before = 4714, after list.add(3) = 34537
record in HashSet, list mutated -> contains = false
== doubles compare with Double.compare semantics ==
NaN record equals NaN record = true
Double.NaN == Double.NaN = false
0.0 record equals -0.0 record = false
0.0 == -0.0 = true
== overriding equals in a record ==
t1.equals(t2) = true
toString still shows both fields: Tagged[isbn=1, title=Effective Java 3e]