Open
Description
- Use Objects.hash for generating simple, dependency-free, hash codes for generated objects.
- Include unit test for all-primitive types, including arrays of primitives
- Include unit test for object containing another generated object as a child object.
import java.util.Objects;
public class Employee {
private String name;
private int id;
private double salary;
public Employee(String name, int id, double salary) {
this.name = name;
this.id = id;
this.salary = salary;
}
@Override
public int hashCode() {
return Objects.hash(name, id, salary);
}
}