### Question:
SynchronizedHashMultiMap { public synchronized int removeIf(BiPredicate<K, V> predicate) { int removedSum = map.values().stream().mapToInt( pairs -> { int removed = 0; Iterator<Pair<K, V>> iter = pairs.iterator(); while (iter.hasNext()) { Pair<K, V> kv = iter.next(); if (predicate.test(kv.getLeft(), kv.getRight())) { iter.remove(); removed++; } } return removed; }).sum(); map.values().removeIf((s) -> s.isEmpty()); return removedSum; }  synchronized void put(K k, V v); synchronized Optional<K> getAnyKey(); synchronized Optional<V> removeAny(K k); synchronized int removeIf(BiPredicate<K, V> predicate);  }### Answer:
@Test public void testRemoveIf() { SynchronizedHashMultiMap<Integer, Integer> map = new SynchronizedHashMultiMap<>(); Assert.assertEquals(map.removeIf((k, v) -> true), 0); map.put(1, 2); map.put(1, 3); map.put(2, 4); map.put(2, 4); Assert.assertEquals(map.removeIf((k, v) -> v == 4), 1); Assert.assertEquals(map.removeIf((k, v) -> k == 1), 2); map.put(1, 2); map.put(1, 3); map.put(2, 4); Assert.assertEquals(map.removeIf((k, v) -> false), 0); Assert.assertEquals(map.removeIf((k, v) -> true), 3); }