Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "javax.swing.JSnarker" Newsgroups: comp.lang.java.programmer Subject: Re: Did the sort do anything? Date: Mon, 16 May 2011 08:05:16 -0400 Organization: media lab? Lines: 37 Message-ID: References: <9303hcFq0nU1@mid.individual.net> NNTP-Posting-Host: Ak7xW7rxcb3Y6UXwoZfR1w.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Forte Agent 2.0/32.652 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4156 On 16/05/2011 8:02 AM, Lawrence D'Oliveiro wrote: > In message, Patricia > Shanahan wrote: > >> Distinct objects probably have different identity hash codes regardless of >> whether their fields all have the same values. > > “By contract, any two objects for which equals(Object) returns true must > return the same hash code value.” > > > > “Distinct” would presumably mean “not equal”. First, that applies to equals and hashCode and to == and identityHashCode, but not to equals and identityHashCode. Second, it means that objects that are the same must have the same hash code, but not the other way around. Different objects are allowed to have the same hash code. >> 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. > > The sort key would have to be consistent with the definition of “equality”, > would it not? If it included the identity hash code, it would have to be consistent with ==. -- public final class JSnarker extends JComponent A JSnarker is an NNTP-aware component that asynchronously provides snarky output when the Ego.needsPuncturing() event is fired in cljp.