Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!