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: Tue, 17 May 2011 07:16:33 -0400 Organization: albasani.net Lines: 28 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 kxYTiYB9fVCsGaaxn3D30O7StlS85axc2B6zkI33X93wJZlrvY1o4KQnCK9kbnGixDh8XgaH6LBF56fe5lvOGLT2rNtrxFT1I/B8jFs7nlmSAPDeq+zJsNP/QTbz2C+P NNTP-Posting-Date: Tue, 17 May 2011 11:16:21 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="BHXnF6xCD8wgRmvX2+SwgDmgfb4OQtw0znhrfGJM3sSpM+t11YyJ4sDQG5/Z1D4d9kau5R6eC4NEafN63YTQ6VyeGJ3o/1Ni0o7asph4WgwKn2N0s+ApCW50r+S+Z4gB"; 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:Uqp9w0SLnAxB0BERw/tQr+kEQ74= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4200 Lawrence D'Oliveiro wrote: > Patricia Shanahan wrote: >> Lawrence D'Oliveiro wrote: >>> 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. No, it does npt. It says that 'System.identityHashCode()' returns the same value as *Object* 'hashCode()', not as the 'x' type's override. I mentioned this before. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg