But does it matter...  As long as you come up with a hashcode that doesn't  
have too many clashes,  and an equals that works,  who cares?

Xor was just habit/old-age....  Add,  or or whatever you fancy...

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Owen Thomas <owen.paul.tho...@gmail.com>
Sent: Sunday, April 19, 2020 3:55:54 PM
To: John Burgess <john.burg...@riskdecisions.com>
Cc: Emilian Bold <emilian.b...@gmail.com>; NetBeans Mailing List 
<users@netbeans.apache.org>
Subject: Re: Overriding equals and hashCode in subclass: wizard doesn't include 
inherited fields.



On Sun, 19 Apr 2020 at 21:44, John Burgess 
<john.burg...@riskdecisions.com<mailto:john.burg...@riskdecisions.com>> 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 xoring the results from 
hashCode, and the results are different. Unfortunately, I think the algorithm 
Java uses to create a hash value is more involved than this, and I'm glad that 
I don't have to know how a hash is actually created. :)

--
I'll cut your code at an intensity and from a place of my own choosing.
Clique Space(TM). Anima ex machina.
Terms & 
Conditions<http://www.riskdecisions.com/risk-decisions-terms-and-conditions>
Unsubscribe<https://riskdecisions.us16.list-manage.com/unsubscribe?u=e2d6b14eee9707f9d08914b88&id=494a0816dd>
 to stop receiving communications from Risk Decisions

Reply via email to