Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!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.57156.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 67a2df60 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:18231 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: >> On 8/12/2012 11:06 AM, Robert Klemme wrote: >>> The whole idea of hashing is based on the fact that the hash code >>> _somehow_ represents the item to be hashed. If all items have the same >>> constant hash code there is no point in hashing at all. So while it >>> does work, it does not work as intended. >> >> It disable the entire hashing functionality and a HashMap get >> characteristics of ArrayList. > > An ArrayList allows multiple occurrences of the same instance - and does > not store key value pairs. That won't be the case with HashMap as > equals() (if properly implemented) will prevent that (albeit slowly, or > more correct: slower than with a proper implementation of hashCode()). > Also, a HashMap will degenerate more to a LinkedList via the chaining of > a bucket's entries. I guess my statement was a bit misleading. ... get O(1) characteristics for getting data similar to various List implementation. 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