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

Method main

collectiontopics/AssociativeArray.java:36–52  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

34 return result.toString();
35 }
36 public static void main(String[] args) {
37 AssociativeArray<String,String> map =
38 new AssociativeArray<>(6);
39 map.put("sky", "blue");
40 map.put("grass", "green");
41 map.put("ocean", "dancing");
42 map.put("tree", "tall");
43 map.put("earth", "brown");
44 map.put("sun", "warm");
45 try {
46 map.put("extra", "object"); // Past the end
47 } catch(ArrayIndexOutOfBoundsException e) {
48 System.out.println("Too many objects!");
49 }
50 System.out.println(map);
51 System.out.println(map.get("ocean"));
52 }
53}
54/* Output:
55Too many objects!

Callers

nothing calls this directly

Calls 2

putMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected