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

Method main

equalshashcode/CountedString.java:40–52  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

38 Objects.equals(id, ((CountedString)o).id);
39 }
40 public static void main(String[] args) {
41 Map<CountedString,Integer> map = new HashMap<>();
42 CountedString[] cs = new CountedString[5];
43 for(int i = 0; i < cs.length; i++) {
44 cs[i] = new CountedString("hi");
45 map.put(cs[i], i); // Autobox int to Integer
46 }
47 System.out.println(map);
48 for(CountedString cstring : cs) {
49 System.out.println("Looking up " + cstring);
50 System.out.println(map.get(cstring));
51 }
52 }
53}
54/* Output:
55{String: hi id: 4 hashCode(): 146450=3, String: hi id:

Callers

nothing calls this directly

Calls 2

getMethod · 0.65
putMethod · 0.45

Tested by

no test coverage detected