### Question:
HashMap extends Map<K, V> { @Override public V remove(K key) { HashMapEntry<K, V> entry = removeEntry(key); if (entry != null) { return entry.value; } return SystemUtils.<V>defaultValue(); } HashMap();  HashMap(int capacity);  HashMap(int capacity, float loadFactor);  HashMap(Map<K, V> map); @Override void clear(); @Override boolean containsKey(K key); @Override boolean containsValue(V value); @Override Set<MapEntry<K, V>> entrySet(); @Override V get(K key); @Override boolean isEmpty(); @Override Set<K> keySet(); @Override V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> map); @Override V remove(K key); @Override int size(); @Override Collection<V> values();  }### Answer:
@Test public void testRemove() { int size = hm.size(); int y = 9; int x = (Integer) hm.remove(Integers.toString(y)); assertTrue("Remove returned incorrect value", x == 9); assertNull("Failed to remove given key", hm.get(9)); assertTrue("Failed to decrement size", hm.size() == (size - 1)); assertNull("Remove of non-existent key returned non-null", hm.remove("LCLCLC")); HashMap<Integer, Object> map = new HashMap<Integer, Object>(); for (int i = 0; i < 32768; i++) { map.put(i, "const"); } Object[] values = new Object[32768]; for (int i = 0; i < 32768; i++) { values[i] = new Object(); map.put(i, values[i]); } for (int i = 32767; i >= 0; i--) { assertEquals("Failed to remove same value", values[i], map.remove(i)); } map = new HashMap<Integer, Object>(); for (int i = -32767; i < 32768; i++) { map.put(i, "foobar"); } assertEquals("foobar", map.get(0)); map.remove(0); assertNull(map.get(0)); }