public int hashCode() { HashCodeBuilder hashCodeBuilder = new HashCodeBuilder(); for (VrpCustomer customer : customerList) { // Notice: we don't use hashCode() hashCodeBuilder.append(customer.solutionHashCode()); } return hashCodeBuilder.toHashCode(); }
public boolean equals(Object o) { if (this == o) { return true; } if (id == null || !(o instanceof VrpSchedule)) { return false; } else { VrpSchedule other = (VrpSchedule) o; if (customerList.size() != other.customerList.size()) { return false; } for (Iterator<VrpCustomer> it = customerList.iterator(), otherIt = other.customerList.iterator(); it.hasNext(); ) { VrpCustomer customer = it.next(); VrpCustomer otherCustomer = otherIt.next(); // Notice: we don't use equals() if (!customer.solutionEquals(otherCustomer)) { return false; } } return true; } }