File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sort song titles

 
Cynthia Yeo
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i sort the titles of the songs in descending order by using String.comparTo() method?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Collections.sort(songs, Collections.reverseOrder());
Assuming that "songs" is a List of song titles or Song objects that have a sensible natural ordering. If not, then please tell us a bit more about your problem.
- Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic