Skip to content

Instantly share code, notes, and snippets.

@deepj
Created March 14, 2009 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepj/79190 to your computer and use it in GitHub Desktop.
Save deepj/79190 to your computer and use it in GitHub Desktop.
@RequestMapping("/book/listByTitle")
public ModelAndView listByTitle() {
List<Book> sorted = bookDAO.getAll();
java.util.Collections.sort(sorted, new Comparator(){
public int compare(Object o1, Object o2) {
Book b1 = (Book) o1;
Book b2 = (Book) o2;
return b1.getTitle().compareTo(b2.getTitle());
}
});
return new ModelAndView("views/book/list", "books", sorted);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment