Beispiel #1
0
 @Override
 public int hashCode() {
   int result = id != null ? id.hashCode() : 0;
   result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
   result = 31 * result + (address != null ? address.hashCode() : 0);
   result = 31 * result + (gender != null ? gender.hashCode() : 0);
   result = 31 * result + (birthdate != null ? birthdate.hashCode() : 0);
   result = 31 * result + (father != null ? father.hashCode() : 0);
   result = 31 * result + (traits != null ? traits.hashCode() : 0);
   return result;
 }
Beispiel #2
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof Person)) return false;

    Person person = (Person) o;

    if (address != null ? !address.equals(person.address) : person.address != null) return false;
    if (birthdate != null ? !birthdate.equals(person.birthdate) : person.birthdate != null)
      return false;
    if (father != null ? !father.equals(person.father) : person.father != null) return false;
    if (firstName != null ? !firstName.equals(person.firstName) : person.firstName != null)
      return false;
    if (gender != person.gender) return false;
    if (id != null ? !id.equals(person.id) : person.id != null) return false;
    if (traits != null ? !traits.equals(person.traits) : person.traits != null) return false;

    return true;
  }