@Test public void testShouldUpdateObject() throws Exception { final TestObject oldObject = map.get(5).get(5); final TestObject expected = new TestObject(oldObject.index); multimap.update(new ObjectsChangedMapUpdater<Integer, TestObject>(expected)); assertNotSame(oldObject, multimap.get(5).get(5)); assertSame(expected, multimap.get(5).get(5)); }
@Nullable @Override public Map<K, List<V>> update(@Nonnull Map<K, List<V>> map) { if (containsChangedObjects(map)) { Map<K, List<V>> result = ThreadSafeMultimap.copy(map); for (List<V> objects : result.values()) { for (int i = 0; i < objects.size(); i++) { final V object = objects.get(i); for (V changedObject : changedObjects) { if (object.equals(changedObject)) { objects.set(i, changedObject); } } } } return result; } else { return null; } }
ObjectsChangedMapUpdater implements ThreadSafeMultimap.MapUpdater<K, V> { @Nullable @Override public Map<K, List<V>> update(@Nonnull Map<K, List<V>> map) { if (containsChangedObjects(map)) { Map<K, List<V>> result = ThreadSafeMultimap.copy(map); for (List<V> objects : result.values()) { for (int i = 0; i < objects.size(); i++) { final V object = objects.get(i); for (V changedObject : changedObjects) { if (object.equals(changedObject)) { objects.set(i, changedObject); } } } } return result; } else { return null; } } }
ObjectsChangedMapUpdater implements ThreadSafeMultimap.MapUpdater<K, V> { @Nullable @Override public Map<K, List<V>> update(@Nonnull Map<K, List<V>> map) { if (containsChangedObjects(map)) { Map<K, List<V>> result = ThreadSafeMultimap.copy(map); for (List<V> objects : result.values()) { for (int i = 0; i < objects.size(); i++) { final V object = objects.get(i); for (V changedObject : changedObjects) { if (object.equals(changedObject)) { objects.set(i, changedObject); } } } } return result; } else { return null; } } ObjectsChangedMapUpdater(@Nonnull V changedObject);  ObjectsChangedMapUpdater(@Nonnull Collection<V> changedObjects); }
ObjectsChangedMapUpdater implements ThreadSafeMultimap.MapUpdater<K, V> { @Nullable @Override public Map<K, List<V>> update(@Nonnull Map<K, List<V>> map) { if (containsChangedObjects(map)) { Map<K, List<V>> result = ThreadSafeMultimap.copy(map); for (List<V> objects : result.values()) { for (int i = 0; i < objects.size(); i++) { final V object = objects.get(i); for (V changedObject : changedObjects) { if (object.equals(changedObject)) { objects.set(i, changedObject); } } } } return result; } else { return null; } } ObjectsChangedMapUpdater(@Nonnull V changedObject);  ObjectsChangedMapUpdater(@Nonnull Collection<V> changedObjects); @Nullable @Override Map<K, List<V>> update(@Nonnull Map<K, List<V>> map); }
ObjectsChangedMapUpdater implements ThreadSafeMultimap.MapUpdater<K, V> { @Nullable @Override public Map<K, List<V>> update(@Nonnull Map<K, List<V>> map) { if (containsChangedObjects(map)) { Map<K, List<V>> result = ThreadSafeMultimap.copy(map); for (List<V> objects : result.values()) { for (int i = 0; i < objects.size(); i++) { final V object = objects.get(i); for (V changedObject : changedObjects) { if (object.equals(changedObject)) { objects.set(i, changedObject); } } } } return result; } else { return null; } } ObjectsChangedMapUpdater(@Nonnull V changedObject);  ObjectsChangedMapUpdater(@Nonnull Collection<V> changedObjects); @Nullable @Override Map<K, List<V>> update(@Nonnull Map<K, List<V>> map);  }