/**
  * Test for content equality between two objects.
  *
  * @param other The object to compare to this one.
  * @return true if the argument object is a set of contact details with matching attributes.
  */
 public boolean equals(Object other) {
   if (other instanceof ContactDetails) {
     ContactDetails otherDetails = (ContactDetails) other;
     return name.equals(otherDetails.getName())
         && phone.equals(otherDetails.getPhone())
         && address.equals(otherDetails.getAddress());
   } else {
     return false;
   }
 }
 /**
  * Compare these details against another set, for the purpose of sorting. The fields are sorted by
  * name, phone, and address.
  *
  * @param otherDetails The details to be compared against.
  * @return a negative integer if this comes before the parameter, zero if they are equal and a
  *     positive integer if this comes after the second.
  */
 public int compareTo(ContactDetails otherDetails) {
   int comparison = name.compareTo(otherDetails.getName());
   if (comparison != 0) {
     return comparison;
   }
   comparison = phone.compareTo(otherDetails.getPhone());
   if (comparison != 0) {
     return comparison;
   }
   return address.compareTo(otherDetails.getAddress());
 }