• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me in using a Comparable with ArrayList for Sorting purpose  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .

 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the other methods of java.util.Collections.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob for the quick response , you mean to say that

is sufficient .



waiitng for your response . Thank you.

 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was exactly the method I wanted you to find.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you .
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!