- public class EmailRecordComparator implements Comparator<EmailRecord>¶
The EmailRecordComparator class is an implementation of the Comparator interface, that allows callers to compare org.motechproject.email.domain.EmailRecord objects by a single field.
- public EmailRecordComparator(Boolean ascending, String compareField)¶
Creates a new EmailRecordComparator that supports comparison based on the specified field.
- ascending – boolean indicating whether comparisons should be ascending or descending
- compareField – the field for which comparisons should be performed
- public int compare(EmailRecord o1, EmailRecord o2)¶
Compares its two arguments for order. If ascending is true, returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. If ascending is false, returns a positive integer, zero, or negative integer as the first argument is less than, equal to, or greater than the second.
- o1 – the first EmailRecord to be compared
- o2 – the second EmailRecord to be compared
a positive integer, zero, or negative integer indicating the result of comparing the objects