How does containsKey really work? I know that if I do this:
Map<String, Integer> map = new HashMap<>();
map.put("user1", 1);
map.put("user2", 2);
map.put("user3", 3);
System.out.println(map.containsKey("user1")); // true
containsKey returns true
but If I do this:
Map<Person, Integer> table = new HashMap<>();
table.put(new Person("Steve"), 33);
table.put(new Person("Mark"), 29);
System.out.println(table.containsKey(new Person("Steve"))); // false
so why am I getting false even if I have the correct key? How do I check for value of 33 by using its key?