### Question:
ManyToManyMap { public boolean remove(L left, R right) { Set<R> rights = lToRMappings.get(left); if (rights != null) { if (rights.remove(right)) { if (rights.isEmpty()) lToRMappings.remove(left); Set<L> lefts = rToLMappings.get(right); lefts.remove(left); if (lefts.isEmpty()) rToLMappings.remove(right); return true; } } return false; } ManyToManyMap();  ManyToManyMap(int initialCapacity);  ManyToManyMap(int initialCapacity, float loadFactor); void add(L left, R right); boolean remove(L left, R right); Set<R> removeAllMappingsForLeft(L left); Set<L> removeAllMappingsForRight(R right); Set<R> getRight(L left); Set<L> getLeft(R right); int size(); int numberOfmappingsForLeft(L left); int numberOfmappingsForRight(R right); boolean containsLeft(L left); boolean containsRight(R right); boolean isEmpty(); void clear(); Iterator<L> leftIterator(); Iterator<R> rightIterator(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testRemove() { ManyToManyMap<String, String> map = new ManyToManyMap<String, String>(); map.add("A.1", "A"); map.add("A.2", "A"); assertEquals(3, map.size()); assertTrue(map.remove("A.1", "A")); assertEquals(2, map.size()); map.add("A.1", "A"); assertEquals(3, map.size()); map = new ManyToManyMap<String, String>(); map.add("A.1", "A"); assertEquals(2, map.size()); map.remove("A.1", "A"); assertEquals(0, map.size()); assertTrue(map.isEmpty()); }