@Override public int hashCode() { int result = id; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (surname != null ? surname.hashCode() : 0); result = 31 * result + hoursWorkedThisMonth; result = 31 * result + (state != null ? state.hashCode() : 0); result = 31 * result + (currentCity != null ? currentCity.hashCode() : 0); result = 31 * result + (currentTruck != null ? currentTruck.hashCode() : 0); return result; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Driver driver = (Driver) o; if (id != driver.id) return false; if (hoursWorkedThisMonth != driver.hoursWorkedThisMonth) return false; if (name != null ? !name.equals(driver.name) : driver.name != null) return false; if (surname != null ? !surname.equals(driver.surname) : driver.surname != null) return false; if (state != driver.state) return false; if (currentCity != null ? !currentCity.equals(driver.currentCity) : driver.currentCity != null) return false; return currentTruck != null ? currentTruck.equals(driver.currentTruck) : driver.currentTruck == null; }