@Test public void testRemove() { final EventList<String> source = new BasicEventList<>(); final Map<String, String> eventMap = GlazedLists.syncEventListToMap(source, new FirstLetterFunction()); assertNull(eventMap.remove("W")); source.addAll(GlazedListsTests.delimitedStringToList("Jesse Wilson Holger Brands")); assertEquals(4, eventMap.size()); eventMap.remove("W"); assertEquals(3, eventMap.size()); assertEquals("Jesse", eventMap.get("J")); assertEquals(null, eventMap.get("W")); assertEquals("Holger", eventMap.get("H")); assertEquals("Brands", eventMap.get("B")); eventMap.remove("J"); assertEquals(2, eventMap.size()); assertEquals(null, eventMap.get("J")); assertEquals(null, eventMap.get("W")); assertEquals("Holger", eventMap.get("H")); assertEquals("Brands", eventMap.get("B")); eventMap.remove("H"); eventMap.remove("B"); assertEquals(0, eventMap.size()); assertTrue(eventMap.isEmpty()); assertNull(eventMap.remove("J")); assertNull(eventMap.remove("W")); assertNull(eventMap.remove("H")); assertNull(eventMap.remove("B")); }
@Override public V remove(Object key) { if (!containsKey(key)) return null; final V value = get(key); valueList.removeIf( v -> v == value ); return value; }
FunctionListMap implements DisposableMap<K, V> { @Override public V remove(Object key) { if (!containsKey(key)) return null; final V value = get(key); valueList.removeIf( v -> v == value ); return value; } }
FunctionListMap implements DisposableMap<K, V> { @Override public V remove(Object key) { if (!containsKey(key)) return null; final V value = get(key); valueList.removeIf( v -> v == value ); return value; } FunctionListMap(EventList<V> source, FunctionList.Function<V, K> keyFunction); }
FunctionListMap implements DisposableMap<K, V> { @Override public V remove(Object key) { if (!containsKey(key)) return null; final V value = get(key); valueList.removeIf( v -> v == value ); return 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 remove(Object key) { if (!containsKey(key)) return null; final V value = get(key); valueList.removeIf( v -> v == value ); return 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();  }