Comparable is always a good idea. But I am curious to know why you are
unable to do a re-SELECT statement?

-----Original Message-----
From: David Haynes [mailto:[EMAIL PROTECTED] 
Sent: March 10, 2003 3:49 PM
To: 'Struts Users Mailing List'
Subject: RE: Sort a collection in alphabetic order

Since you are in a while(rs.next()) context, why not sort on insertion?
Just pop your results into a Vector (or other collection) in sort-order.
Depending upon the number of elements expected, you could speed the
insertion using a number of methods. If your lists are relatively small,
it may be efficient to just start at the beginning of the vector and
walk through it looking for the insertion point.

-david-

-----Original Message-----
From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Sent: March 10, 2003 1:25 PM
To: 'Struts Users Mailing List'
Subject: SV: Sort a collection in alphabetic order

It is not possible.

The select is in a while (rs.next()) {} depending on another value. (Not
easy to explain!!)

I am a ware of normal SQL order by

-----Oprindelig meddelelse-----
Fra: Dave Newton [mailto:[EMAIL PROTECTED] 
Sendt: 10. marts 2003 19:20
Til: Struts Users Mailing List
Emne: Re: Sort a collection in alphabetic order

On Mon, 2003-03-10 at 13:16, Søren Blidorf wrote:
> I need to sort my collection "people" in alphabetic order by lastname,
> firstname. Can anybody help me?

Most algorithm books will give you more information than you want on
sorting.

Why not just do it in the query and let the db do it?

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to