Skip to content

Instantly share code, notes, and snippets.

@tamizhgeek
Created March 10, 2012 13:49
Show Gist options
  • Save tamizhgeek/2011455 to your computer and use it in GitHub Desktop.
Save tamizhgeek/2011455 to your computer and use it in GitHub Desktop.
Contact class
class Contact {
protected String name;
protected String number;
protected String id;
protected Contact(String name, String number) {
this.name = name;
this.number = number;
}
/**
* @return the string for the Listview */
@Override
public String toString() {
return name + ":" + number;
}
public int compareTo(Contact c) {
String c1 = c.name.toUpperCase();
String c2 = this.name.toUpperCase();
return c2.compareTo(c1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment