Re: Did the sort do anything?
On 5/20/2011 5:00 AM, Patricia Shanahan wrote:
On 5/19/2011 11:46 PM, Lawrence D'Oliveiro wrote:
In message<kYCdnSqcI7kP40_QnZ2dnUVZ_gydnZ2d@earthlink.com>, Patricia
Shanahan wrote:
Now that we have clarified the fact that System.identityHashCode(x) is
not merely a synonym for x.hashCode(), have you changed your mind about
the need, or otherwise, for stability when sorting Java objects based on
the entire value of the object's fields?
What do you think I said about ???the need, or otherwise, for stability????
"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???."
[http://groups.google.com/group/comp.lang.java.programmer/msg/17e3a8e513ceab46]
To further refresh your memory, the question I raised was whether you
consider System.identityHashCode(x) to be part of the "entire object
state" of the object referenced by x.
If the answer is "yes", then sorts whose key is the entire object state
are so extremely rare that I've never seen one.
If the answer is "no", then even if the sort key is the entire object
state, the subsequent program behavior, such as the performance of an
IdentityHashMap, can be affected by whether the sort is stable or not,
so stability is relevant.
Patricia