Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Car {
- private String brand;
- private String model;
- private String color;
- private String engine;
- private String transmission;
- private String dateCreated;
- public Car() {
- }
- public Car(String brand, String model, String color, String engine, String transmission, String dateCreated) {
- this.brand = brand;
- this.model = model;
- this.color = color;
- this.engine = engine;
- this.transmission = transmission;
- this.dateCreated = dateCreated;
- }
- public String getBrand() {
- return brand;
- }
- public void setBrand(String brand) {
- this.brand = brand;
- }
- public String getModel() {
- return model;
- }
- public void setModel(String model) {
- this.model = model;
- }
- public String getColor() {
- return color;
- }
- public void setColor(String color) {
- this.color = color;
- }
- public String getEngine() {
- return engine;
- }
- public void setEngine(String engine) {
- this.engine = engine;
- }
- public String getTransmission() {
- return transmission;
- }
- public void setTransmission(String transmission) {
- this.transmission = transmission;
- }
- public String getDateCreated() {
- return dateCreated;
- }
- public void setDateCreated(String dateCreated) {
- this.dateCreated = dateCreated;
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((brand == null) ? 0 : brand.hashCode());
- result = prime * result + ((color == null) ? 0 : color.hashCode());
- result = prime * result + ((dateCreated == null) ? 0 : dateCreated.hashCode());
- result = prime * result + ((engine == null) ? 0 : engine.hashCode());
- result = prime * result + ((model == null) ? 0 : model.hashCode());
- result = prime * result + ((transmission == null) ? 0 : transmission.hashCode());
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Car other = (Car) obj;
- if (brand == null) {
- if (other.brand != null)
- return false;
- } else if (!brand.equals(other.brand))
- return false;
- if (color == null) {
- if (other.color != null)
- return false;
- } else if (!color.equals(other.color))
- return false;
- if (dateCreated == null) {
- if (other.dateCreated != null)
- return false;
- } else if (!dateCreated.equals(other.dateCreated))
- return false;
- if (engine == null) {
- if (other.engine != null)
- return false;
- } else if (!engine.equals(other.engine))
- return false;
- if (model == null) {
- if (other.model != null)
- return false;
- } else if (!model.equals(other.model))
- return false;
- if (transmission == null) {
- if (other.transmission != null)
- return false;
- } else if (!transmission.equals(other.transmission))
- return false;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement