コード例 #1
0
 @Override
 public int hashCode() {
   int result = super.hashCode();
   result = 31 * result + name.hashCode();
   result = 31 * result + (category != null ? category.hashCode() : 0);
   return result;
 }
コード例 #2
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;

    DemographicOption option = (DemographicOption) o;

    if (!name.equals(option.name)) return false;
    return !(category != null ? !category.equals(option.category) : option.category != null);
  }