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

Method main

java/Chapter 8/Question8_10/Question.java:5–32  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3public class Question {
4
5 public static void main(String[] args) {
6 Dummy bob = new Dummy("Bob", 20);
7 Dummy jim = new Dummy("Jim", 25);
8 Dummy alex = new Dummy("Alex", 30);
9 Dummy tim = new Dummy("Tim", 35);
10 Dummy maxwell = new Dummy("Maxwell", 40);
11 Dummy john = new Dummy("John", 45);
12 Dummy julie = new Dummy("Julie", 50);
13 Dummy christy = new Dummy("Christy", 55);
14 Dummy tim2 = new Dummy("Tim", 100); // This should replace the first "tim"
15
16 Dummy[] dummies = {bob, jim, alex, tim, maxwell, john, julie, christy, tim2};
17
18 /* Test: Insert Elements. */
19 Hash<String, Dummy> hash = new Hash<String, Dummy>();
20 for (Dummy d : dummies) {
21 hash.put(d.getName(), d);
22 }
23
24 hash.debugPrintHash();
25
26 /* Test: Recall */
27 for (Dummy d : dummies) {
28 String name = d.getName();
29 Dummy dummy = hash.get(name);
30 System.out.println("Dummy named " + name + ": " + dummy.toString());
31 }
32 }
33
34}

Callers

nothing calls this directly

Calls 5

putMethod · 0.95
debugPrintHashMethod · 0.95
getMethod · 0.95
toStringMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected