MCPcopy
hub / github.com/careercup/ctci / get

Method get

java/Chapter 8/Question8_10/Hash.java:34–47  ·  view source on GitHub ↗
(K key)

Source from the content-addressed store, hash-verified

32 }
33
34 public V get(K key) {
35 int x = hashCodeOfKey(key);
36 if (items[x] == null) {
37 return null;
38 }
39 LinkedList<Cell<K, V>> collided = items[x];
40 for (Cell<K, V> c : collided) {
41 if (c.equivalent(key)) {
42 return c.getValue();
43 }
44 }
45
46 return null;
47 }
48
49 public void debugPrintHash() {
50 for (int i = 0; i < items.length; i++) {

Callers 15

mainMethod · 0.95
ChapQ3.5.pyFile · 0.45
getLastStackMethod · 0.45
leftShiftMethod · 0.45
findMethod · 0.45
findMethod · 0.45
addCardToScoreListMethod · 0.45
isBlackJackMethod · 0.45
shuffleMethod · 0.45
dealCardMethod · 0.45
getHandlerForCallMethod · 0.45
dispatchCallMethod · 0.45

Calls 3

hashCodeOfKeyMethod · 0.95
equivalentMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected