### Question:
MultiValueMap extends HashMap<K, V> { public V add(K key, V value){ if(super.containsKey(key)){ V existing = super.get(key); existing.getValues().addAll(value.getValues()); return super.put(key, existing); }else{ return super.put(key, value); } }  V add(K key, V value); @Override V put(K key, V value); Set<java.util.Map.Entry<K, V>> stream();  }### Answer:
@Test public void itShouldAdd() { MultiValueMap<String, MultiValue> mvm = new MultiValueMap<>(); MultiValue<String,String> mv = new MultiValue<>("Test", "This is a test"); mvm.add("Test", mv); Assert.assertEquals("This is a test", mvm.get("Test").getValues().toArray()[0]); }
@Test public void itShouldAddTwoKeys() { MultiValueMap<String, MultiValue> mvm = new MultiValueMap<>(); MultiValue<String,String> mv = new MultiValue<>("Test", "This is a test"); MultiValue<String,String> mv2 = new MultiValue<>("Test", "This is a test"); mvm.add("Test", mv); mvm.add("Test", mv2); Assert.assertEquals(2, mvm.get("Test").getValues().toArray().length); }