Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.ripco.com!news.glorb.com!news-out.readnews.com!transit4.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail From: "Arne Vajhøj" Subject: Re: hashCode Message-ID: <50327C3B.57157.calajapr@time.synchro.net> X-Comment-To: Robert Klemme Newsgroups: comp.lang.java.programmer In-Reply-To: <502943B8.56784.calajapr@time.synchro.net> References: <502943B8.56784.calajapr@time.synchro.net> X-FTN-AREA: COMP.LANG.JAVA.PROGRAMMER X-FTN-MSGID: 1:261/38 85ef00c4 X-FTN-REPLY: 1:261/38 86d7d342 Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] Lines: 32 Date: Mon, 20 Aug 2012 18:58:36 GMT NNTP-Posting-Host: 69.21.70.65 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1345489116 69.21.70.65 (Mon, 20 Aug 2012 13:58:36 CDT) NNTP-Posting-Date: Mon, 20 Aug 2012 13:58:36 CDT Organization: tds.net Xref: csiph.com comp.lang.java.programmer:18232 To: Robert Klemme From: Arne Vajhoj On 8/13/2012 1:17 PM, Robert Klemme wrote: > On 12.08.2012 22:59, Arne Vajhoj wrote: >> But the code should actually work. > > Yes, sort of - depending on whether O(1) is a requirement or not. That is a rare functional requirement. (common non-functional) > Still, > the idea to implement hashCode() in Object in a way to return a constant > to avoid necessity of overriding it is crazy - especially since you then > cannot efficiently use Object as hash key - which you can today. Actually the more I think about the question the more logical it sounds! We are looking at two alternatives: A) default functions properly but good performance requires an override B) default gives good performance but may need an override to function properly #A actually sounds more the Java way to me. 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