Junior — Senior
HashSet does not recognize identical User objects
livecode
Task condition
In the User class, only the name field is declared. When adding two User instances with the same name value to a HashSet, both objects end up in the set. You need to fix this so that the HashSet treats such objects as equal and stores only one element for each unique name.
public class User {
private String name;
public User(String name) {
this.name = name;
}
}