Skip to content

Instantly share code, notes, and snippets.

@doom369
Created August 2, 2020 08:57
Show Gist options
  • Save doom369/9ccacf4182a3ad394fd745d49abee12f to your computer and use it in GitHub Desktop.
Save doom369/9ccacf4182a3ad394fd745d49abee12f to your computer and use it in GitHub Desktop.
class User {
String email;
int age;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
User that = (User) o;
return age == that.age
&& Objects.equals(email, that.email);
}
@Override
public int hashCode() {
return Objects.hash(email, age);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment