User Pojo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
private final String id; | |
private final String name; | |
public User(final String id, final String name) { | |
this.id = id; | |
this.name = name; | |
} | |
@Override | |
public boolean equals(final Object o) { | |
if (this == o) { | |
return true; | |
} | |
if (!(o instanceof User)) { | |
return false; | |
} | |
final User user = (User) o; | |
if (id != null ? !id.equals(user.id) : user.id != null) { | |
return false; | |
} | |
return name != null ? name.equals(user.name) : user.name == null; | |
} | |
public String getId() { | |
return id; | |
} | |
public String getName() { | |
return name; | |
} | |
@Override | |
public int hashCode() { | |
int result = id != null ? id.hashCode() : 0; | |
result = 31 * result + (name != null ? name.hashCode() : 0); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment