Equality
Doug Lea
dl at cs.oswego.edu
Fri Dec 18 20:21:54 UTC 2015
On 12/18/2015 12:48 PM, Brian Goetz wrote:
> So perhaps what this says is we are going to get pushed in the other direction
> -- that we'll want to superate equals().
>
What if plain-equals and value-equals are independently overridable,
with defaults:
boolean equals(any x) { return (x instanceof ThisClass) && equalValue(x); }
boolean equalValue(ThisClass x) { ... check bit equality ... }
(The equalValue method could be named "equals" too, but doing so
is too confusing for now.)
Where operator== calls equalValue, not plain equals.
The effects cascade to many of the Collection methods.
-Doug
More information about the valhalla-spec-experts
mailing list