Exemple #1
0
  @Override
  public boolean equals(Object obj) {
    try {
      ContactList other = (ContactList) obj;
      // If they're different sizes, the contact
      // set is obviously different.
      if (size() != other.size()) {
        return false;
      }

      // Make sure all the individual contacts are the same.
      for (Contact c : this) {
        if (!other.contains(c)) {
          return false;
        }
      }

      return true;
    } catch (ClassCastException e) {
      return false;
    }
  }