Skip to content

Instantly share code, notes, and snippets.

@kubawieczorek
Last active December 15, 2019 14:29
Show Gist options
  • Save kubawieczorek/252060eccb9d646da0b7b366f815aceb to your computer and use it in GitHub Desktop.
Save kubawieczorek/252060eccb9d646da0b7b366f815aceb to your computer and use it in GitHub Desktop.
class Car {
private String type;
private BigDecimal price;
public Car(String type, BigDecimal price) {
this.type = type;
this.price = price;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Car)) {
return false;
}
Car car = (Car) o;
return car.type.equals(type) &&
car.price.equals(price);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment