Win a copy of Learning Java by Building Android Games this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Sorting  RSS feed

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

List object contains the bellow information

Praneeth ABC 5 ID Operation
John DEF 6 DI OPeration
Jim XYZ 9 IDS Operation
Praneeth ABC 2 ID2 Operation
Praneeth DEF 3 ID Operation
Jim XYZ 9 IDS Operation
Jim XYZ 4 IDS Operation


now i want to retrive it in the bellow format (all the names should be in order)

Praneeth ABC 5 ID Operation
Praneeth ABC 2 ID2 Operation
Praneeth DEF 3 ID Operation
Jim XYZ 9 IDS Operation
Jim XYZ 9 IDS Operation
Jim XYZ 4 IDS Operation
John DEF 6 DI OPeration

Can anyone suggest the logic .
 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is your order to sort?
 
Ranch Hand
Posts: 41
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compareTo method of the Comparable interface. Implementing Comparable allows calling Collections.sort. It is always costly process in java to sort. It is usually much preferred to let the database perform the sort using the ORDER BY clause, rather than in code.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!