sort it in the private method readPlanObjectFromDB... in the query DB....
select * from my_table ORDER BY .....



|---------+---------------------------->
|         |           "Krishna Mohan   |
|         |           Radhakrishnan"   |
|         |           <[EMAIL PROTECTED]|
|         |           nfosys.com>      |
|         |                            |
|         |           10/03/2005 09:35 |
|         |           Please respond to|
|         |           "Struts Users    |
|         |           Mailing List"    |
|         |                            |
|         |                            |
|         |                            |
|         |                            |
|---------+---------------------------->
  
>------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                 |
  |       To:       "Struts Users Mailing List" <user@struts.apache.org>        
                                                 |
  |       cc:                                                                   
                                                 |
  |       bcc:                                                                  
                                                 |
  |       Subject:  Sorting of array lists                                      
                                                 |
  
>------------------------------------------------------------------------------------------------------------------------------|





Hi all,

I have a doubt regarding sorting in array List.

I have an array List  which contains array list objects of type Plan.

The Plan object contains 3 variables : plantitle ,plandescription and
planname.

I have to sort the arraylist based on the plantitle first and then based
on the plandescription.


ArrayList list = new ArrayList();
Plan planobj = null;
For (i= 1, i<=100, i++){
planObj = readPlanObjectFromDB();
list.add(planObj);

}

//?? Now how to sort it


Private Plan readPlanObjectFromDB(){
//queries the database to return plan object

return plan;
}

I am totally confused. Even if use bubble sorting it will cause a lot of
performance issues.

Could any one please suggest me a good method?

Regards,
Krishna Mohan


---------------------------------------------------------------------
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