Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 16 May 2011 05:53:21 -0500 Date: Mon, 16 May 2011 03:53:21 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Did the sort do anything? References: <9303hcFq0nU1@mid.individual.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 27 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-JFw4gtXQXPhg/e47+5rmrbDvnHFXRmPqtNHKZeWGJz0yyi7s7Rh8Ye8evFLYi7hlX8R+gDd7AXJ4IXe!fKT+V3FXGNcJ9xbAuPomxSWOu2J7tkP93yIP9WNpXqcqK9d2Kdazy5fexLa+LpFRykG00Ra4NLUs!ogQBhAfcYxNUE51fSa7CFEPtYm8UbsaTmSACSLqGSQc= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2453 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4154 On 5/15/2011 10:57 PM, Lawrence D'Oliveiro wrote: > In message, Patricia > Shanahan wrote: > >> On 5/15/2011 7:32 PM, Lawrence D'Oliveiro wrote: >> >>> If, on the other hand, you were sorting immutable objects of a Java >>> “reference” type where the key was the entire object state, then >>> stability would indeed be irrelevant, notwithstanding such types are not >>> considered “primitive”. >> >> Do you consider the result of System.identityHashCode(x) to be part of >> the state of the object referenced by x? > > It is computed from the state, is it not? > Only if you consider it to be part of the state. Distinct objects probably have different identity hash codes regardless of whether their fields all have the same values. Its existence ensures that program behavior can be affected by object sort stability or instability, even if the sort key includes all fields. The sort key would have to also include the identity hash code to make stability irrelevant. Patricia