Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: Did the sort do anything? Date: Fri, 13 May 2011 07:46:47 -0700 Organization: Canadian Mind Products Lines: 24 Message-ID: References: <9303hcFq0nU1@mid.individual.net> Reply-To: Roedy Green NNTP-Posting-Host: RCd/Ul4tyxGUBII8WGwa5g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4056 On Thu, 12 May 2011 10:40:57 -0400, Joshua Cranmer wrote, quoted or indirectly quoted someone who said : > >Java uses quicksort for primitive types in Arrays.sort and mergesort for >reference types: since you can't distinguish two equal primitive types, >you can't tell that quicksort isn't stable. Java's sort on objects is stable IIRC. There you can tell apart objects that compare equal by their addresses if not other fields in the object not used in the compare. In all my years, I had never noticed that stability is irrelevant for primitives. It is like a pleasant little backscratch to have that brought to my attention. -- Roedy Green Canadian Mind Products http://mindprod.com How long did it take after the car was invented before owners understood cars would not work unless you regularly changed the oil and the tires? We have gone 33 years and still it is rare to uncover a user who understands computers don't work without regular backups.