@Override public V2 remove(Object rowKey, Object columnKey) { return contains(rowKey, columnKey) ? function.apply(fromTable.remove(rowKey, columnKey)) : null; }
/** * @param userId * @param itemId * @return */ public double reomve(int userId, int itemId) { double previouslyValue = table.remove(userId, itemId); return previouslyValue; }
/** * Deletes the given attribute from the given view. */ public synchronized final void deleteAttribute(String view, String attribute) { if (attributes != null) { attributes.remove(view, attribute); } }
@Override public V2 remove(Object rowKey, Object columnKey) { return contains(rowKey, columnKey) ? function.apply(fromTable.remove(rowKey, columnKey)) : null; }
private static <R, C, V> void merge( Table<R, C, V> table, R row, C column, V value, BinaryOperator<V> mergeFunction) { checkNotNull(value); V oldValue = table.get(row, column); if (oldValue == null) { table.put(row, column, value); } else { V newValue = mergeFunction.apply(oldValue, value); if (newValue == null) { table.remove(row, column); } else { table.put(row, column, newValue); } } }
@Override public V remove(Object rowKey, Object columnKey) { assertTrue(Thread.holdsLock(mutex)); return delegate.remove(rowKey, columnKey); }
@CanIgnoreReturnValue @Override public V remove(Object rowKey, Object columnKey) { return delegate().remove(rowKey, columnKey); }
@Override public V remove(@Nullable Object rowKey, @Nullable Object columnKey) { return original.remove(columnKey, rowKey); }
@Override public V2 remove(Object rowKey, Object columnKey) { return contains(rowKey, columnKey) ? function.apply(fromTable.remove(rowKey, columnKey)) : null; }
@Override public V remove(@Nullable Object rowKey, @Nullable Object columnKey) { synchronized (mutex) { return delegate().remove(rowKey, columnKey); } }
@Override public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) { synchronized (mutex) { return delegate().remove(rowKey, columnKey); } }
@CanIgnoreReturnValue @Override public V remove(Object rowKey, Object columnKey) { return delegate().remove(rowKey, columnKey); }
@Override public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) { return original.remove(columnKey, rowKey); }
@CanIgnoreReturnValue @Override public V remove(Object rowKey, Object columnKey) { return delegate().remove(rowKey, columnKey); }
@Override public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) { return original.remove(columnKey, rowKey); }
public final void testRemove() { for (Table<Character, Integer, String> testInstance : getTestInstances()) { try { testInstance.remove('a', 1); fail(); } catch (UnsupportedOperationException e) { // success } } }
@Override public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) { synchronized (mutex) { return delegate().remove(rowKey, columnKey); } }
public void testRowClearAndPut() { if (supportsRemove()) { table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c'); Map<Integer, Character> row = table.row("foo"); assertEquals(ImmutableMap.of(1, 'a', 3, 'c'), row); table.remove("foo", 3); assertEquals(ImmutableMap.of(1, 'a'), row); table.remove("foo", 1); assertEquals(ImmutableMap.of(), row); table.put("foo", 2, 'b'); assertEquals(ImmutableMap.of(2, 'b'), row); row.clear(); assertEquals(ImmutableMap.of(), row); table.put("foo", 5, 'x'); assertEquals(ImmutableMap.of(5, 'x'), row); } } }
public void testSubRowClearAndPut() { table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c'); SortedMap<Integer, Character> row = (SortedMap<Integer, Character>) table.row("foo"); SortedMap<Integer, Character> subRow = row.tailMap(2); assertEquals(ImmutableMap.of(1, 'a', 3, 'c'), row); assertEquals(ImmutableMap.of(3, 'c'), subRow); table.remove("foo", 3); assertEquals(ImmutableMap.of(1, 'a'), row); assertEquals(ImmutableMap.of(), subRow); table.remove("foo", 1); assertEquals(ImmutableMap.of(), row); assertEquals(ImmutableMap.of(), subRow); table.put("foo", 2, 'b'); assertEquals(ImmutableMap.of(2, 'b'), row); assertEquals(ImmutableMap.of(2, 'b'), subRow); row.clear(); assertEquals(ImmutableMap.of(), row); assertEquals(ImmutableMap.of(), subRow); table.put("foo", 5, 'x'); assertEquals(ImmutableMap.of(5, 'x'), row); assertEquals(ImmutableMap.of(5, 'x'), subRow); } }
public void testRemove() { table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c'); if (supportsRemove()) { assertNull(table.remove("cat", 1)); assertNull(table.remove("bar", 3)); assertEquals(3, table.size()); assertEquals((Character) 'c', table.remove("foo", 3)); assertEquals(2, table.size()); assertEquals((Character) 'a', table.get("foo", 1)); assertEquals((Character) 'b', table.get("bar", 1)); assertNull(table.get("foo", 3)); assertNull(table.remove(null, 1)); assertNull(table.remove("foo", null)); assertNull(table.remove(null, null)); assertSize(2); } else { try { table.remove("foo", 3); fail(); } catch (UnsupportedOperationException expected) { } assertEquals((Character) 'c', table.get("foo", 3)); } }