コード例 #1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Flower flower = (Flower) o;

    if (name != null ? !name.equals(flower.name) : flower.name != null) return false;
    return pot != null ? pot.equals(flower.pot) : flower.pot == null;
  }
コード例 #2
0
 @Override
 public int hashCode() {
   int result = name != null ? name.hashCode() : 0;
   result = 31 * result + (pot != null ? pot.hashCode() : 0);
   return result;
 }