Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Did the sort do anything? Date: Fri, 20 May 2011 07:10:44 -0400 Organization: albasani.net Lines: 46 Message-ID: References: <9303hcFq0nU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net ZEUHSQM0iEicMmWVOSTVWVUEjHbL/JRrP/BhnKoI8M6fUGn0s0zlXEo9zN6y3WYcN2DwhhISw4PFDPM2e9YcTY0sgz2AyvGYJd3c0Y2FofPzulvsAau419fsXYOY1Rte NNTP-Posting-Date: Fri, 20 May 2011 11:10:41 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="/3d+e/Gk8z4GnTxrjhBa6Sk9aqNj9rT4/3p1nqS8JHZdVzBw7U7jwlHSEu0a2s/Q73/r+pEHboCKbvF2JlPjGZ/pwUTNUm4sm8OrrDnti7Jo1FfsZsd61Ty+d9KhBJR3"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:q2HKpfXSJ0dKw/+k8H+RnLFr5gg= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4352 On 05/20/2011 02:46 AM, Lawrence D'Oliveiro wrote: > In message, Patricia > Shanahan wrote: > >> On 5/17/2011 12:11 AM, Lawrence D'Oliveiro wrote: >> >>> In message, Patricia >>> Shanahan wrote: >>> >>>> On 5/16/2011 2:11 PM, Lawrence D'Oliveiro wrote: >>>> >>>>> In message, Patricia >>>>> Shanahan wrote: >>>>> >>>>>> System.identityHashCode(x) does not necessarily return the same as >>>>>> x.hashCode() ... >>>>> >>>>> It says it does >>>>> > : >>>>> >>>>> The hash code returned is the same one that would be returned by >>>>> the method java.lang.Object.hashCode(), whether or not the >>>>> object's class has overridden hashCode(). >>>> >>>> My sample program output showed both x.hashCode() and >>>> System.identityHashCode(x) for x referencing an Integer. The values were >>>> different, because Integer overrides hashCode. >>> >>> How odd, because the above documentation says otherwise. >>> >> >> The way I interpret it, and the way it works in practice, is that >> System.identityHashCode(x) returns the value that would be returned by >> x.hashCode() if the object referenced by x had inherited the Object >> implementation of hashCode, regardless of whether x in fact uses an >> overridden hash code. > > Ah. Fair enough. That was only pointed out about five times, O Lawrence. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg