If a DB is being used, just use an "order by" clause 
in the select statement.


Scott Stirling wrote:
> 
> If it's a hard-coded 2-dimensional array, like you've shown below, the
> fastest thing would be to sort the values when you code them into the
> program, rather than at runtime.  But do you mean that, or will you be
> dynamically loading 2000 rows at runtime that need to be sorted?  If that's
> the case, then having the database (assuming a database is involved) store
> the names in the order you need them returned is a good idea.
> 
> Finally, if you really need to sort them at runtime, I (or someone else on
> the list) can dig up a fast sort algorithm in a minute . . .
> 
> Scott Stirling
> Macromedia
> 
> -----Original Message-----
> From: JustinMacCarthy
> To: JRun-Talk
> Sent: 8/29/01 6:09 AM
> Subject: Java Sorting
> 
> What the best ways to sort somthing like these (eg by firstname ,
> surname
> ,position) but for 20000 rows ?.
> 
> Assuming worst case ordering
> 
> String[][] data =
> 
>             { "Stephen", "Cheng", "Vice President" },
>             { "Joe", "Berrey", "Intern" },
>             { "Adam", "Lipinski", "Director" },
>             { "Lynne", "Teague", "Developer" }
>             {..... etc }
> 
> }
> 
> Can do it Perl etc , but Im a Java  newbie.
> Thanks
> 
> J
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to