01: package org.claros.intouch.contacts.utility;
02:
03: import java.util.Comparator;
04:
05: import org.claros.intouch.contacts.models.Contact;
06:
07: /**
08: * @author Umut Gokbayrak
09: */
10: public class ContactsComparator implements Comparator {
11: private boolean nameFirst = true;
12:
13: public ContactsComparator(boolean nameFirst) {
14: this .nameFirst = nameFirst;
15: }
16:
17: /* (non-Javadoc)
18: * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
19: */
20: public int compare(Object arg0, Object arg1) {
21: Contact c1 = (Contact) arg0;
22: Contact c2 = (Contact) arg1;
23:
24: String f1 = Utility.getFullName(c1, nameFirst);
25: String f2 = Utility.getFullName(c2, nameFirst);
26: return f1.compareTo(f2);
27: }
28: }
|