Пример #1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ShipMovement that = (ShipMovement) o;

    if (movements != null ? !movements.equals(that.movements) : that.movements != null)
      return false;
    if (ship != null ? !ship.equals(that.ship) : that.ship != null) return false;

    return true;
  }
Пример #2
0
 @Override
 public int hashCode() {
   int result = ship != null ? ship.hashCode() : 0;
   result = 31 * result + (movements != null ? movements.hashCode() : 0);
   return result;
 }