@Test public void testShouldLeaveOldListIfObjectDoesntExist() throws Exception { final List<TestObject> listBefore = multimap.asMap().get(3); multimap.update(3, new ObjectRemovedUpdater<TestObject>(new TestObject(111))); final List<TestObject> listAfter = multimap.asMap().get(3); assertSame(listBefore, listAfter); }
@Nullable @Override public List<V> update(@Nonnull List<V> values) { if (values == ThreadSafeMultimap.NO_VALUE) { return null; } else if (Iterables.contains(values, removedObject)) { final List<V> result = ThreadSafeMultimap.copy(values); result.remove(removedObject); return result; } else { return null; } }
ObjectRemovedUpdater implements ThreadSafeMultimap.ListUpdater<V> { @Nullable @Override public List<V> update(@Nonnull List<V> values) { if (values == ThreadSafeMultimap.NO_VALUE) { return null; } else if (Iterables.contains(values, removedObject)) { final List<V> result = ThreadSafeMultimap.copy(values); result.remove(removedObject); return result; } else { return null; } } }
ObjectRemovedUpdater implements ThreadSafeMultimap.ListUpdater<V> { @Nullable @Override public List<V> update(@Nonnull List<V> values) { if (values == ThreadSafeMultimap.NO_VALUE) { return null; } else if (Iterables.contains(values, removedObject)) { final List<V> result = ThreadSafeMultimap.copy(values); result.remove(removedObject); return result; } else { return null; } } ObjectRemovedUpdater(@Nonnull V removedObject); }
ObjectRemovedUpdater implements ThreadSafeMultimap.ListUpdater<V> { @Nullable @Override public List<V> update(@Nonnull List<V> values) { if (values == ThreadSafeMultimap.NO_VALUE) { return null; } else if (Iterables.contains(values, removedObject)) { final List<V> result = ThreadSafeMultimap.copy(values); result.remove(removedObject); return result; } else { return null; } } ObjectRemovedUpdater(@Nonnull V removedObject); @Nullable @Override List<V> update(@Nonnull List<V> values); }
ObjectRemovedUpdater implements ThreadSafeMultimap.ListUpdater<V> { @Nullable @Override public List<V> update(@Nonnull List<V> values) { if (values == ThreadSafeMultimap.NO_VALUE) { return null; } else if (Iterables.contains(values, removedObject)) { final List<V> result = ThreadSafeMultimap.copy(values); result.remove(removedObject); return result; } else { return null; } } ObjectRemovedUpdater(@Nonnull V removedObject); @Nullable @Override List<V> update(@Nonnull List<V> values);  }