### Question:
SynchronizedHashMultiMap { public synchronized Optional<K> getAnyKey() { return map.values().stream().findAny().flatMap(pairs -> pairs.stream().findAny().map(p -> p.getLeft())); }  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 testGetAnyKey() { SynchronizedHashMultiMap<Integer, Integer> map = new SynchronizedHashMultiMap<>(); Assert.assertFalse(map.getAnyKey().isPresent()); map.put(1, 2); Assert.assertEquals(map.getAnyKey().get(), Integer.valueOf(1)); map.put(1, 3); Assert.assertEquals(map.getAnyKey().get(), Integer.valueOf(1)); map.put(2, 4); int res = map.getAnyKey().get(); Assert.assertTrue(res == 1 || res == 2); map.removeIf((k, v) -> k == 1); Assert.assertEquals(map.getAnyKey().get(), Integer.valueOf(2)); }