EmailRecordComparator¶
-
public class
EmailRecordComparator
implements Comparator<EmailRecord>¶ The
EmailRecordComparator
class is an implementation of the Comparator interface, that allows callers to compareorg.motechproject.email.domain.EmailRecord
objects by a single field.
Constructors¶
EmailRecordComparator¶
-
public
EmailRecordComparator
(Boolean ascending, String compareField)¶ Creates a new
EmailRecordComparator
that supports comparison based on the specified field.Parameters: - ascending – boolean indicating whether comparisons should be ascending or descending
- compareField – the field for which comparisons should be performed
Methods¶
compare¶
-
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 isfalse
, returns a positive integer, zero, or negative integer as the first argument is less than, equal to, or greater than the second.Parameters: - o1 – the first
EmailRecord
to be compared - o2 – the second
EmailRecord
to be compared
Returns: a positive integer, zero, or negative integer indicating the result of comparing the objects
- o1 – the first