01: package pygmy.nntp.http;
02:
03: import pygmy.nntp.http.ForumMessage;
04:
05: import java.util.Comparator;
06:
07: public class MessageDateComparator implements Comparator {
08: public int compare(Object o1, Object o2) {
09: ForumMessage msg1 = (ForumMessage) o1;
10: ForumMessage msg2 = (ForumMessage) o2;
11:
12: if (msg1.getPostDate().after(msg2.getPostDate())) {
13: return -1;
14: } else if (msg1.getPostDate().equals(msg2.getPostDate())) {
15: return msg1.getGuid().compareTo(msg2.getGuid());
16: } else {
17: return 1;
18: }
19: }
20: }
|