This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes sorting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "sorting" Watch "sorting" New topic


vasu kasukurthi

Joined: Dec 14, 2009
Posts: 9
i have data in a file like

i have to read data and need to sort like the following

Please can any one help me.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45302
Have you tried a Comparator? Have you written down on paper what the rules are to provide a "natural ordering"?
Patricia Samuel
Ranch Hand

Joined: Sep 12, 2007
Posts: 300
Yes, you have to use Comparator for that purpose and the logic could be like you have to get substring and then have to sort those parts.....
It is sorta covered in the JavaRanch Style Guide.
subject: sorting
It's not a secret anymore!