@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ContactData other = (ContactData) obj; if (getFirstname() == null) { if (other.getFirstname() != null) return false; } else if (!getFirstname().equals(other.getFirstname())) return false; if (getLastname() == null) { if (other.getLastname() != null) return false; } else if (!getLastname().equals(other.getLastname())) return false; return true; }
@Override public int compareTo(ContactData other) { int result = this.getFirstname().toLowerCase().compareTo(other.getFirstname().toLowerCase()); if (result == 0) { result = this.getLastname().compareTo(other.getLastname().toLowerCase()); } return result; }