Removes a specific value associated with the specified key. If the value is removed and no more values remain for the key, the key is also removed. @param key the key whose value is to be removed @param value the value to remove @return true if the value was removed, false otherwi
(K key, V value)
| 50 | * @return {@code true} if the value was removed, {@code false} otherwise |
| 51 | */ |
| 52 | public boolean remove(K key, V value) { |
| 53 | List<V> values = map.get(key); |
| 54 | if (values != null) { |
| 55 | boolean removed = values.remove(value); |
| 56 | if (values.isEmpty()) { |
| 57 | map.remove(key); // Clean up the key if no values remain |
| 58 | } |
| 59 | return removed; |
| 60 | } |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Removes all values associated with the specified key. |
no test coverage detected