Created
August 2, 2020 08:57
-
-
Save doom369/9ccacf4182a3ad394fd745d49abee12f to your computer and use it in GitHub Desktop.
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
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