✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
class User { private String name; User(String name) { this.name = name; } @Override public boolean equals(Object obj) { if (!(obj instanceof User)) return false; User other = (User) obj; return name.equals(other.name); } } Set users = new HashSet<>(); users.add(new User("Alex")); users.add(new User("Alex")); System.out.println(users.size());