MCPcopy Index your code
hub / github.com/careercup/ctci / addContact

Method addContact

java/Chapter 8/Question8_7/User.java:52–59  ·  view source on GitHub ↗
(User user)

Source from the content-addressed store, hash-verified

50 }
51
52 public boolean addContact(User user) {
53 if (contacts.containsKey(user.getId())) {
54 return false;
55 } else {
56 contacts.put(user.getId(), user);
57 return true;
58 }
59 }
60
61 public void receivedAddRequest(AddRequest req) {
62 int senderId = req.getFromUser().getId();

Callers 1

approveAddRequestMethod · 0.95

Calls 2

putMethod · 0.80
getIdMethod · 0.45

Tested by

no test coverage detected