Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail From: "=?UTF-8?B?QXJuZSBWYWpow7hq?=" <=?utf-8?b?qxjuzsbwywpow7hq?=@1:261/38.remove-nlb-this> Subject: Re: hashCode Message-ID: <502943B4.56759.calajapr@time.synchro.net> X-Comment-To: Patricia Shanahan Newsgroups: comp.lang.java.programmer In-Reply-To: <5027F2CB.56704.calajapr@time.synchro.net> References: <5027F2CB.56704.calajapr@time.synchro.net> X-FTN-AREA: COMP.LANG.JAVA.PROGRAMMER X-FTN-MSGID: 1:261/38 163abb58 X-FTN-REPLY: 1:261/38 b099093f Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] Lines: 26 Date: Mon, 13 Aug 2012 18:36:17 GMT NNTP-Posting-Host: 69.21.70.65 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1344882977 69.21.70.65 (Mon, 13 Aug 2012 13:36:17 CDT) NNTP-Posting-Date: Mon, 13 Aug 2012 13:36:17 CDT Organization: tds.net X-Received-Bytes: 2065 Xref: csiph.com comp.lang.java.programmer:17811 To: Patricia Shanahan From: =?UTF-8?B?QXJuZSBWYWpow7hq?= On 8/12/2012 12:40 PM, Patricia Shanahan wrote: > Keeping hashCode as an Object method but making it useless for bucket > selection unless overridden would not be a good alternative. > > A more reasonable alternative would be to have hashCode as the only > member of a HashKey interface that would be implemented by every class > whose objects are intended to be suitable for use as has keys. Those > objects that have a hashCode would still have to have a usable one, but > some classes would not implement HashKey and not have a hashCode at all. That would avoid using the hash for classes where it does not make much sense. I like it. Given that there is a gazillion lines of code out there that stores Object, then it can not be changed. 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