@Test public void putValueShouldStoreKeyAndValue() { AttributeMap<String, String> attributeMap = new AttributeMap<>(); String key = "key"; String value = "value"; attributeMap.putIfValueNotNull(key, value); assertEquals(value, attributeMap.get(key)); }
public AttributeMap<K, V> putIfValueNotNull(K key, V value) { if (value != null) { super.put(key, value); } else { super.remove(key); } return this; }
AttributeMap extends HashMap<K, V> { public AttributeMap<K, V> putIfValueNotNull(K key, V value) { if (value != null) { super.put(key, value); } else { super.remove(key); } return this; } }
AttributeMap extends HashMap<K, V> { public AttributeMap<K, V> putIfValueNotNull(K key, V value) { if (value != null) { super.put(key, value); } else { super.remove(key); } return this; }  }
AttributeMap extends HashMap<K, V> { public AttributeMap<K, V> putIfValueNotNull(K key, V value) { if (value != null) { super.put(key, value); } else { super.remove(key); } return this; }  AttributeMap<K, V> putIfValueNotNull(K key, V value); }
AttributeMap extends HashMap<K, V> { public AttributeMap<K, V> putIfValueNotNull(K key, V value) { if (value != null) { super.put(key, value); } else { super.remove(key); } return this; }  AttributeMap<K, V> putIfValueNotNull(K key, V value);  }