2008-11-01 17:32:06 -04:00
|
|
|
|
2010-05-19 14:17:06 -04:00
|
|
|
package com.fsck.k9.controller;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
import java.util.Comparator;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.mail.Message;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class MessageDateComparator implements Comparator<Message> {
|
|
|
|
public int compare(Message o1, Message o2) {
|
|
|
|
try {
|
|
|
|
if (o1.getSentDate() == null) {
|
2008-11-01 17:32:06 -04:00
|
|
|
return 1;
|
2011-02-06 17:09:48 -05:00
|
|
|
} else if (o2.getSentDate() == null) {
|
2008-11-01 17:32:06 -04:00
|
|
|
return -1;
|
2011-02-06 17:09:48 -05:00
|
|
|
} else
|
2008-11-01 17:32:06 -04:00
|
|
|
return o2.getSentDate().compareTo(o1.getSentDate());
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (Exception e) {
|
2008-11-01 17:32:06 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|