### Question:
Maps { @SuppressWarnings("unchecked") public static <K, T> void addListValue(final Map<K, List<T>> map, final K key, final T value) { if (!map.containsKey(key)) { map.put(key, new ArrayList<T>(Arrays.asList(value))); } else { map.get(key).add(value); } }  @SuppressWarnings("unchecked") static void addListValue(final Map<K, List<T>> map, final K key, final T value); static void addArrayValue(final Map<T, String[]> map, final T key, final String value); static T getListValue(final Map<String, List<T>> values, final String name, final int index); static Map<String, String[]> toArrayMap(final Map<String, List<String>> parameterMap);  }### Answer:
@Test public void testAddListValueUninitialized() { Map<String, List<String>> map = new TreeMap<String, List<String>>(); Assert.assertNull(map.get("lincoln")); Maps.addListValue(map, "lincoln", "baxter"); Assert.assertEquals("baxter", map.get("lincoln").get(0)); }
@Test public void testAddListValueInitialized() { Map<String, List<String>> map = new TreeMap<String, List<String>>(); Assert.assertNull(map.get("lincoln")); Maps.addListValue(map, "lincoln", "baxter"); Maps.addListValue(map, "lincoln", "III"); Assert.assertEquals("baxter", map.get("lincoln").get(0)); Assert.assertEquals("III", map.get("lincoln").get(1)); }