@Test public void testPut() { final EventList<String> source = new BasicEventList<>(); final Map<String, String> eventMap = GlazedLists.syncEventListToMap(source, new FirstLetterFunction()); assertTrue(eventMap.values().isEmpty()); assertEquals(null, eventMap.put("J", "James")); assertEquals(1, eventMap.size()); assertEquals("James", eventMap.get("J")); assertEquals("James", eventMap.put("J", "Jesse")); assertEquals(1, eventMap.size()); assertEquals("Jesse", eventMap.get("J")); assertEquals(null, eventMap.put("K", "Katie")); assertEquals(2, eventMap.size()); assertEquals("Jesse", eventMap.get("J")); assertEquals("Katie", eventMap.get("K")); try { eventMap.put("Z", "Ashford"); fail("failed to receive IllegalArgumentException when using a key and value that do not agree"); } catch (IllegalArgumentException iae) { } }
@Override public V put(K key, V value) { checkKeyValueAgreement(key, value); return putNoAgreementCheck(key, value); }
FunctionListMap implements DisposableMap<K, V> { @Override public V put(K key, V value) { checkKeyValueAgreement(key, value); return putNoAgreementCheck(key, value); } }
FunctionListMap implements DisposableMap<K, V> { @Override public V put(K key, V value) { checkKeyValueAgreement(key, value); return putNoAgreementCheck(key, value); } FunctionListMap(EventList<V> source, FunctionList.Function<V, K> keyFunction); }
FunctionListMap implements DisposableMap<K, V> { @Override public V put(K key, V value) { checkKeyValueAgreement(key, value); return putNoAgreementCheck(key, value); } FunctionListMap(EventList<V> source, FunctionList.Function<V, K> keyFunction); @Override void dispose(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V get(Object key); @Override V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override void clear(); @Override V remove(Object key); @Override Collection<V> values(); @Override Set<K> keySet(); @Override Set<Entry<K, V>> entrySet(); @Override void forEach(BiConsumer<? super K, ? super V> action); @Override boolean equals(Object o); @Override int hashCode(); }
FunctionListMap implements DisposableMap<K, V> { @Override public V put(K key, V value) { checkKeyValueAgreement(key, value); return putNoAgreementCheck(key, value); } FunctionListMap(EventList<V> source, FunctionList.Function<V, K> keyFunction); @Override void dispose(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override boolean containsValue(Object value); @Override V get(Object key); @Override V put(K key, V value); @Override void putAll(Map<? extends K, ? extends V> m); @Override void clear(); @Override V remove(Object key); @Override Collection<V> values(); @Override Set<K> keySet(); @Override Set<Entry<K, V>> entrySet(); @Override void forEach(BiConsumer<? super K, ? super V> action); @Override boolean equals(Object o); @Override int hashCode();  }