@Test public void testPut() { final EventList<String> source = new BasicEventList<>(); final Map<Comparable<String>, List<String>> eventMap = GlazedLists.syncEventListToMultiMap(source, new FirstLetterFunction()); assertTrue(eventMap.values().isEmpty()); assertEquals(null, eventMap.put("J", GlazedListsTests.delimitedStringToList("James"))); assertEquals(1, eventMap.size()); assertEquals(GlazedListsTests.delimitedStringToList("James"), eventMap.get("J")); assertEquals(GlazedListsTests.delimitedStringToList("James"), eventMap.put("J", GlazedListsTests.delimitedStringToList("Jesse Jiries"))); assertEquals(1, eventMap.size()); assertEquals(GlazedListsTests.delimitedStringToList("Jesse Jiries"), eventMap.get("J")); assertEquals(GlazedListsTests.delimitedStringToList("Jesse Jiries"), eventMap.put("J", new BasicEventList<String>())); assertTrue(eventMap.isEmpty()); try { eventMap.put("Z", GlazedListsTests.delimitedStringToList("Ashford")); fail("failed to receive IllegalArgumentException when using a key and value that do not agree"); } catch (IllegalArgumentException iae) { } try { eventMap.put("Z", GlazedListsTests.delimitedStringToList("Zorro Ashford")); fail("failed to receive IllegalArgumentException when using a key and value that do not agree"); } catch (IllegalArgumentException iae) { } }
@Override public List<V> put(K key, List<V> value) { checkKeyValueAgreement(key, value); final List<V> removed = remove(key); groupingList.add(value); return removed; }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public List<V> put(K key, List<V> value) { checkKeyValueAgreement(key, value); final List<V> removed = remove(key); groupingList.add(value); return removed; } }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public List<V> put(K key, List<V> value) { checkKeyValueAgreement(key, value); final List<V> removed = remove(key); groupingList.add(value); return removed; } GroupingListMultiMap(EventList<V> source, FunctionList.Function<V, ? extends K> keyFunction, Comparator<? super K> keyGrouper); }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public List<V> put(K key, List<V> value) { checkKeyValueAgreement(key, value); final List<V> removed = remove(key); groupingList.add(value); return removed; } 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); }
GroupingListMultiMap implements DisposableMap<K, List<V>>, ListEventListener<List<V>> { @Override public List<V> put(K key, List<V> value) { checkKeyValueAgreement(key, value); final List<V> removed = remove(key); groupingList.add(value); return removed; } 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);  }