### Question:
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public Set<Entry<K, List<V>>> entrySet() { if (entrySet == null) entrySet = new EntrySet(); return entrySet; } GroupingListMultiMap(EventList<V> source, FunctionList.Function<V, ? extends K> keyFunction, Comparator<? super K> keyGrouper); @Override void dispose(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override List<V> get(Object key); @Override List<V> put(K key, List<V> value); @Override void putAll(Map<? extends K, ? extends List<V>> m); @Override void clear(); @Override List<V> remove(Object key); @Override Collection<List<V>> values(); @Override Set<K> keySet(); @Override Set<Entry<K, List<V>>> entrySet(); @Override boolean equals(Object o); @Override int hashCode(); @Override void listChanged(ListEvent<List<V>> listChanges);  }### Answer:
@Test public void testEntrySet() { final EventList<String> source = new BasicEventList<>(); final Map<Comparable<String>, List<String>> eventMap = GlazedLists.syncEventListToMultiMap(source, new FirstLetterFunction()); assertTrue(eventMap.isEmpty()); assertTrue(eventMap.entrySet().isEmpty()); source.addAll(GlazedListsTests.delimitedStringToList("James Lemieux Jesse Wilson Jodie Ashford Katie Jiries")); assertEquals(8, source.size()); assertEquals(5, eventMap.size()); assertEquals(5, eventMap.entrySet().size()); assertFalse(eventMap.entrySet().contains(null)); assertTrue(eventMap.entrySet().remove(eventMap.entrySet().iterator().next())); assertEquals(7, source.size()); assertEquals(4, eventMap.size()); assertEquals(4, eventMap.entrySet().size()); assertTrue(eventMap.entrySet().remove(eventMap.entrySet().iterator().next())); assertEquals(3, source.size()); assertEquals(3, eventMap.size()); assertEquals(3, eventMap.entrySet().size()); eventMap.entrySet().clear(); assertEquals(0, source.size()); assertEquals(0, eventMap.size()); assertEquals(0, eventMap.entrySet().size()); assertTrue(source.isEmpty()); assertTrue(eventMap.isEmpty()); assertTrue(eventMap.entrySet().isEmpty()); }
@Test public void testMapEntrySetValue() { final EventList<String> source = new BasicEventList<>(); final Map<Comparable<String>, List<String>> eventMap = GlazedLists.syncEventListToMultiMap(source, new FirstLetterFunction()); source.addAll(GlazedListsTests.delimitedStringToList("James Lemieux Jesse Wilson Jodie Ashford Katie Jiries")); Iterator<Map.Entry<Comparable<String>, List<String>>> entrySetIter = eventMap.entrySet().iterator(); Map.Entry<Comparable<String>, List<String>> entry; assertTrue(entrySetIter.hasNext()); entry = entrySetIter.next(); assertEquals("A", entry.getKey()); assertEquals(GlazedListsTests.delimitedStringToList("Ashford"), entry.getValue()); final List<String> oldEntryValue = entry.getValue(); entry.setValue(GlazedListsTests.delimitedStringToList("Angela Applegate")); assertEquals("A", entry.getKey()); assertEquals(GlazedListsTests.delimitedStringToList("Angela Applegate"), entry.getValue()); assertSame(oldEntryValue, entry.getValue()); try { entry.setValue(GlazedListsTests.delimitedStringToList("Xavier")); fail("failed to receive an IllegalArgumentException for a value to Entry.setValue() that does not produce the correct Entry.getKey()"); } catch (IllegalArgumentException e) { } }