Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/web/books/SortBooksByBookYear.java @ 89:85e27da9b18a
New feature : add book_year and edition_year in Books page
author | Calvin Yeh <cyeh@mpipw-berlin.mpg.com> |
---|---|
date | Wed, 21 Jun 2017 05:58:54 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
88:f4242db6206b | 89:85e27da9b18a |
---|---|
1 package de.mpiwg.web.books; | |
2 | |
3 import java.util.Comparator; | |
4 | |
5 import de.mpiwg.gazetteer.db.DBBook; | |
6 | |
7 | |
8 public class SortBooksByBookYear implements Comparator<DBBook>{ | |
9 | |
10 public int compare(DBBook o1, DBBook o2) { | |
11 | |
12 if(o1 == null || o2 == null){ | |
13 return o1.getName().compareTo(o2.getName()); | |
14 } | |
15 | |
16 return o1.getBookYear().compareTo(o2.getBookYear()); | |
17 } | |
18 | |
19 } |