- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashCodeTest.java
More file actions
Latest commit
23 lines (18 loc) · 628 Bytes
/
Copy pathHashCodeTest.java
File metadata and controls
23 lines (18 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
packagebasic;
importbasic.model.User;
importjava.util.HashMap;
importjava.util.Map;
publicclassHashCodeTest {
publicstaticvoidmain(String[] args) {
Map<User, User> users = newHashMap<>();
Useruser1 = newUser(1L, "John", "john@domain.com");
Useruser2 = newUser(2L, "Jennifer", "jennifer@domain.com");
Useruser3 = newUser(3L, "Mary", "mary@domain.com");
users.put(user1, user1);
users.put(user2, user2);
users.put(user3, user3);
if (users.containsKey(user1)) {
System.out.print("User found in the collection");
}
}
}