1// EXAMPLE CLASS
2public class User {
3 private String name;
4 private int age;
5 private String passport;
6
7 @Override public boolean equals(Object o) {
8 if (o == this) {
9 return true;
10 }
11 if (!(o instanceof User)) {
12 return false;
13 }
14
15 User user = (User) o;
16
17 return user.name.equals(name) &&
18 user.age == age &&
19 user.passport.equals(passport);
20 }
21
22 @Override public int hashCode() {
23 int result = 17;
24 result = 31 * result + name.hashCode();
25 result = 31 * result + age;
26 result = 31 * result + passport.hashCode();
27 return result;
28 }