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

Method main

java/Chapter 10/Question10_7/Question.java:10–35  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

8 }
9
10 public static void main(String[] args) {
11 Cache cache = new Cache();
12 for (int i = 0; i < 20; i++) {
13 String query = "query" + i;
14 cache.insertResults(query, generateResults(i));
15 if (i == 9 || i == 16 || i == 19) {
16 cache.getResults("query" + 2);
17 cache.getResults("query" + 6);
18 cache.getResults("query" + 9);
19 }
20 }
21
22 for (int i = 0; i < 30; i++) {
23 String query = "query" + i;
24 String[] results = cache.getResults(query);
25 System.out.print(query + ": ");
26 if (results == null) {
27 System.out.print("null");
28 } else {
29 for (String s : results) {
30 System.out.print(s + ", ");
31 }
32 }
33 System.out.println("");
34 }
35 }
36}

Callers

nothing calls this directly

Calls 4

insertResultsMethod · 0.95
generateResultsMethod · 0.95
getResultsMethod · 0.95
printMethod · 0.45

Tested by

no test coverage detected