On Sun, 19 Apr 2020 at 21:44, John Burgess
wrote:
> Xor the hashcode of the inherited fields (from super. Hashcode() ) and the
> hsshcode of the new fields.
>
This solution might be a fair enough, and I might be seen as being
pedantic, but I checked the output by using Objects.hash versus
ubject: Re: Overriding equals and hashCode in subclass: wizard doesn't include
inherited fields.
I don't know how calls to hashCode can be chained. Is there anything that can
do that?
I can implement hashCode in final classes using Objects.hash(), but I suppose
it would be niche to b
I don't know how calls to hashCode can be chained. Is there anything that
can do that?
I can implement hashCode in final classes using Objects.hash(), but I
suppose it would be niche to be able to progressively build a hash code.
On Sun, 19 Apr 2020 at 17:09, Emilian Bold wrote:
> Interesting.
Interesting. Another idea might be to rely on super.hashCode and
super.equals somewhere in there?
--emi
On Sun, Apr 19, 2020 at 6:00 AM Owen Thomas
wrote:
> Hi. I'm using NB 11.0.
>
> I'm trying to override equals and hashCode for a subclass of a type that
> extends object. The inherited
Hi. I'm using NB 11.0.
I'm trying to override equals and hashCode for a subclass of a type that
extends object. The inherited class and the subclass both declare fields
and getters for them.
It seems unfortunate to me that the NB wizard that one usually uses to
generate the code for equals and