Re: Sorting of array lists

2005-03-10 Thread PA
On Mar 10, 2005, at 10:36, Rikesh Balan Krishnan wrote: But all this methods are applicable only if the model class extends the comparator interface. No. If your "model class" do not implement java.lang.Comparable, you can provide your own java.util.Comparator to java.util.Collections.sort() an

RE: Sorting of array lists

2005-03-10 Thread Mark Benussi
iling List Subject: RE: Sorting of array lists But all this methods are applicable only if the model class extends the comparator interface.I too had a similar problem,but I was not able to use the collection.sort because if the model class doesn't extend the comparator interface, it will gi

RE: Sorting of array lists

2005-03-10 Thread Rikesh Balan Krishnan
e for a alofrithm where I wrote a sort method.I'm still looking for some different method. -Original Message- From: Mark Benussi [mailto:[EMAIL PROTECTED] Sent: Thursday, March 10, 2005 2:39 PM To: 'Struts Users Mailing List' Subject: RE: Sorting of array lists Krishna

Re: Sorting of array lists

2005-03-10 Thread Ext . Ilitia2
sort it in the private method readPlanObjectFromDB... in the query DB select * from my_table ORDER BY . |-+> | | "Krishna Mohan | | | Radhakrishnan" | | | <[EMAIL PROTECTED]| | |

RE: Sorting of array lists

2005-03-10 Thread Mark Benussi
Krishna, The below example uses a comparator which orders a collection of objects based on a property. You can make the criteria more complicated if you wish. import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class Test { public static void ma

Re: Sorting of array lists

2005-03-10 Thread Nicolas De Loof
Use Collections.sort(list, new Comparator() {...}); or Collections.sort(list) if your Plan class implements Comparable Nico. Krishna Mohan Radhakrishnan a écrit : 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 o