.. java:import:: java.util Comparator EmailRecordComparator ===================== .. java:package:: org.motechproject.email.domain :noindex: .. java:type:: public class EmailRecordComparator implements Comparator The \ ``EmailRecordComparator``\ class is an implementation of the Comparator interface, that allows callers to compare \ :java:ref:`org.motechproject.email.domain.EmailRecord`\ objects by a single field. Constructors ------------ EmailRecordComparator ^^^^^^^^^^^^^^^^^^^^^ .. java:constructor:: public EmailRecordComparator(Boolean ascending, String compareField) :outertype: EmailRecordComparator Creates a new \ ``EmailRecordComparator``\ that supports comparison based on the specified field. :param ascending: boolean indicating whether comparisons should be ascending or descending :param compareField: the field for which comparisons should be performed Methods ------- compare ^^^^^^^ .. java:method:: @Override public int compare(EmailRecord o1, EmailRecord o2) :outertype: EmailRecordComparator 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. :param o1: the first \ ``EmailRecord``\ to be compared :param o2: the second \ ``EmailRecord``\ to be compared :return: a positive integer, zero, or negative integer indicating the result of comparing the objects