MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

collectiontopics/CanonicalMapping.java:35–51  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

33
34public class CanonicalMapping {
35 public static void main(String[] args) {
36 int size = 1000;
37 // Or, choose size via the command line:
38 if(args.length > 0)
39 size = Integer.valueOf(args[0]);
40 Key[] keys = new Key[size];
41 WeakHashMap<Key,Value> map =
42 new WeakHashMap<>();
43 for(int i = 0; i < size; i++) {
44 Key k = new Key(Integer.toString(i));
45 Value v = new Value(Integer.toString(i));
46 if(i % 3 == 0)
47 keys[i] = k; // Save as "real" references
48 map.put(k, v);
49 }
50 System.gc();
51 }
52}

Callers

nothing calls this directly

Calls 2

toStringMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected