Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #17803
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail |
|---|---|
| From | "Arne Vajhøj" <arne.vajhøj@1:261/38.remove-nlb-this> |
| Subject | Re: hashCode |
| Message-ID | <502943B2.56751.calajapr@time.synchro.net> (permalink) |
| X-Comment-To | Roedy Green |
| Newsgroups | comp.lang.java.programmer |
| X-FTN-AREA | COMP.LANG.JAVA.PROGRAMMER |
| X-FTN-MSGID | 1:261/38 69b42663 |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] |
| Lines | 42 |
| Date | Mon, 13 Aug 2012 18:36:15 GMT |
| NNTP-Posting-Host | 69.21.70.65 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1344882975 69.21.70.65 (Mon, 13 Aug 2012 13:36:15 CDT) |
| NNTP-Posting-Date | Mon, 13 Aug 2012 13:36:15 CDT |
| Organization | tds.net |
| Xref | csiph.com comp.lang.java.programmer:17803 |
Show key headers only | View raw
To: Roedy Green From: "Arne Vajhoj" <arne.vajhoj@1:261/38.remove-m2z-this> To: Roedy Green From: Arne Vajhoj <arne@vajhoej.dk> On 8/11/2012 7:54 AM, Roedy Green wrote: > On Fri, 10 Aug 2012 12:45:07 -0700 (PDT), Lew <lewbloch@gmail.com> > wrote, quoted or indirectly quoted someone who said : > >> h =3D 31 * h + attribute.hashCode(); >> } > In my essay I recommend XOR which is an inherentely faster operation > than multiply. I wonder which actually works out better. Multiply. XOR has several problems: - many small values give small result - same values in different fields give same result - two identical values give result zero + all those I did not think of. > If you had a > large number of fields, the multiply effect could fall off the left > hand end. It is the algorithm used for String which could have very > long strings, so Sun must have thought of that. The multiply effect does not fall off the left with a value like 31 (it would with 32). Arne -+- BBBS/Li6 v4.10 Dada-1 + Origin: Prism bbs (1:261/38) -+- Synchronet 3.16a-Win32 NewsLink 1.98 Time Warp of the Future BBS - telnet://time.synchro.net:24 --- BBBS/Li6 v4.10 Dada-1 * Origin: Prism bbs (1:261/38) --- Synchronet 3.16a-Win32 NewsLink 1.98 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: hashCode "Arne Vajhøj" <arne.vajhøj@1:261/38.remove-nlb-this> - 2012-08-13 18:36 +0000
csiph-web