tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russ Kepler <r...@kepler-eng.com>
Subject Re: This is just plain ... odd.
Date Thu, 08 Nov 2012 16:10:05 GMT
On Thursday, November 08, 2012 03:06:51 PM Lyallex wrote:
> > I'm not sure that you can ever get consistent results if the input order
> > is
> > random.
> 
> Well perhaps 'random' was a bit 'random' the select returns the data in the
> same order it was entered, ordered by id.
> Not necessarily the same as alpha as I'm sure you appreciate. the fact is
> that the data was always returned in the same order
> by the database, just not the order I wanted. This is why I was
> particularly confused.
> 
> Whatever, your code works, now I just gotta figure out why

Because you were only handling one end of the compare against the special 
object.  Since the special object could appear as the object to be compared 
against as well as the object performing the compare the merge sort was being 
given conflicting comparisons against the special object - always the greatest 
when the special was performing the compare and alphabetically(ish) when it 
was the object given to the compare method.

You got the same (wrongish) results since you gave the sort the same order in 
the list.  I can't recall how merge sort can freak out when given conflicting 
compares, I seem to recall that you might get an endless loop under some 
circumstances as it orders and reorders the same group of objects.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message