File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Help me in using a Comparable with ArrayList for Sorting purpose Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Help me in using a Comparable with ArrayList for Sorting purpose" Watch "Help me in using a Comparable with ArrayList for Sorting purpose" New topic
Author

Help me in using a Comparable with ArrayList for Sorting purpose

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

I have defined a DTO of a Employee with name , age and other properties .


On to the EMployeeDTO i have overriden the compareTo method as required for my business .

Please tell me what should i do on to my DAO Layer of getEmployeeDetails() , so that i can display the results as per the Name order of the Employee .

I am struck up here

After filling the ArrayList with the Employees .

All the examplyes of Net uses Collections.sort(list , ComparatorObject);

But in my case it is of a Comparable

Please share your ideas

Thanks in advance .


Save India From Corruption - Anna Hazare.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Check out the other methods of java.util.Collections.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thanks Rob for the quick response , you mean to say that

is sufficient .



waiitng for your response . Thank you.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

That was exactly the method I wanted you to find.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you .
 
jQuery in Action, 2nd edition
 
subject: Help me in using a Comparable with ArrayList for Sorting purpose
 
Similar Threads
sort HashMap by Key object's value
How to Represent dynamic Image data into XML
array List Program
Sorting with Treeset