com.google.common.collect.Maps.safeRemove()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中com.google.common.collect.Maps.safeRemove()方法的一些代码示例,展示了Maps.safeRemove()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Maps.safeRemove()方法的具体详情如下:
包路径:com.google.common.collect.Maps
类名称:Maps
方法名:safeRemove

Maps.safeRemove介绍

[英]Delegates to Map#remove. Returns null on ClassCastException and NullPointerException.
[中]

代码示例

代码示例来源:origin: google/j2objc

/** Removes all values for the provided key. */
private void removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 if (collection != null) {
  int count = collection.size();
  collection.clear();
  totalSize -= count;
 }
}

代码示例来源:origin: google/guava

/** Removes all values for the provided key. */
private void removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 if (collection != null) {
  int count = collection.size();
  collection.clear();
  totalSize -= count;
 }
}

代码示例来源:origin: wildfly/wildfly

/** Removes all values for the provided key. */
private void removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 if (collection != null) {
  int count = collection.size();
  collection.clear();
  totalSize -= count;
 }
}

代码示例来源:origin: google/guava

@CanIgnoreReturnValue
@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: google/j2objc

@CanIgnoreReturnValue
@Override
public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: wildfly/wildfly

@CanIgnoreReturnValue
@Override
public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/** Removes all values for the provided key. */
private void removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 if (collection != null) {
  int count = collection.size();
  collection.clear();
  totalSize -= count;
 }
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

/** Removes all values for the provided key. */
private void removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 if (collection != null) {
  int count = collection.size();
  collection.clear();
  totalSize -= count;
 }
}

代码示例来源:origin: com.google.guava/guava-jdk5

/**
 * Removes all values for the provided key. Unlike {@link #removeAll}, it
 * returns the number of removed mappings.
 */
private int removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 int count = 0;
 if (collection != null) {
  count = collection.size();
  collection.clear();
  totalSize -= count;
 }
 return count;
}

代码示例来源:origin: Nextdoor/bender

/**
 * Removes all values for the provided key. Unlike {@link #removeAll}, it
 * returns the number of removed mappings.
 */
private int removeValuesForKey(Object key) {
 Collection<V> collection = Maps.safeRemove(map, key);
 int count = 0;
 if (collection != null) {
  count = collection.size();
  collection.clear();
  totalSize -= count;
 }
 return count;
}

代码示例来源:origin: com.diffplug.guava/guava-collect

/**
 * Removes all values for the provided key. Unlike {@link #removeAll}, it
 * returns the number of removed mappings.
 */
private int removeValuesForKey(Object key) {
  Collection<V> collection = Maps.safeRemove(map, key);
  int count = 0;
  if (collection != null) {
    count = collection.size();
    collection.clear();
    totalSize -= count;
  }
  return count;
}

代码示例来源:origin: com.google.guava/guava-jdk5

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: Nextdoor/bender

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: com.diffplug.guava/guava-collect

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
  Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
  return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@CanIgnoreReturnValue
@Override
public V remove(@Nullable Object rowKey, @Nullable Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@CanIgnoreReturnValue
@Override
public V remove(@NullableDecl Object rowKey, @NullableDecl Object columnKey) {
 Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
 return (row == null) ? null : Maps.safeRemove(row, columnKey);
}

相关文章