public class Disease { private final String name; public Disease(String name) { this.name = name; } public String getName() { return name; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Disease disease = (Disease) o; return name.equals(disease.name); } @Override public int hashCode() { return name.hashCode(); } @Override public String toString() { return name; } }