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

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

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

Multimap.containsValue介绍

[英]Returns true if this multimap contains at least one key-value pair with the value value.
[中]如果此多重映射至少包含一个具有该值的键值对,则返回true。

代码示例

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

@Override
public boolean containsValue(Object value) {
 synchronized (mutex) {
  return delegate().containsValue(value);
 }
}

代码示例来源:origin: MovingBlocks/Terasology

public boolean containsValue(T value) {
  return inner.containsValue(value);
}

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

@Override
public boolean containsValue(Object value) {
 synchronized (mutex) {
  return delegate().containsValue(value);
 }
}

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

@Override
public boolean containsValue(@Nullable Object value) {
 return delegate().containsValue(value);
}

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

@Override
public boolean containsValue(Object value) {
 synchronized (mutex) {
  return delegate().containsValue(value);
 }
}

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

@MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES)
 public void testContainsNullValueFails() {
  try {
   multimap().containsValue(null);
   fail("Expected NullPointerException");
  } catch (NullPointerException expected) {
   // success
  }
 }
}

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

@MapFeature.Require(ALLOWS_NULL_VALUE_QUERIES)
public void testContainsNullValueNo() {
 assertFalse(multimap().containsValue(null));
}

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

@NoWarning("GC")
public static void testMultimapOK(Multimap<String, Integer> mm) {
  mm.containsEntry("x", 1);
  mm.containsKey("x");
  mm.containsValue(1);
  mm.remove("x", 1);
  mm.removeAll("x");
}
@NoWarning("GC")

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

@Override
public boolean containsValue(@NullableDecl Object value) {
 return delegate().containsValue(value);
}

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

public void testContainsValueNo() {
 assertFalse(multimap().containsValue(v3()));
}

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

@ExpectWarning(value="GC", num=7)
public static void testMultimap(Multimap<String, Integer> mm) {
  mm.containsEntry("x", "y");
  mm.containsEntry(1, 5);
  mm.containsKey(1);
  mm.containsValue("x");
  mm.remove("x", "x");
  mm.remove(1, 2);
  mm.removeAll(1);
}

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

@NoWarning("GC")
public static void testMultimapOK2(Multimap<String, Pair<Integer,Long>> mm) {
  Pair<Integer, Long> p = new Pair<Integer, Long>(1, 1L);
  mm.containsEntry("x", p);
  mm.containsKey("x");
  mm.containsValue(p);
  mm.remove("x", p);
  mm.removeAll("x");
}

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

@Override
public boolean containsValue(@NullableDecl Object value) {
 return delegate().containsValue(value);
}

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

@CollectionSize.Require(absent = ZERO)
public void testContainsValueYes() {
 assertTrue(multimap().containsValue(v0()));
}

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

@MapFeature.Require(ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testContainsNullValueYes() {
 initMultimapWithNullValue();
 assertTrue(multimap().containsValue(null));
}

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

public void testEmptyMultimapReads() {
 Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
 assertFalse(multimap.containsKey("foo"));
 assertFalse(multimap.containsValue(1));
 assertFalse(multimap.containsEntry("foo", 1));
 assertTrue(multimap.entries().isEmpty());
 assertTrue(multimap.equals(HashMultimap.create()));
 assertEquals(Collections.emptySet(), multimap.get("foo"));
 assertEquals(0, multimap.hashCode());
 assertTrue(multimap.isEmpty());
 assertEquals(HashMultiset.create(), multimap.keys());
 assertEquals(Collections.emptySet(), multimap.keySet());
 assertEquals(0, multimap.size());
 assertTrue(multimap.values().isEmpty());
 assertEquals("{}", multimap.toString());
}

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

public void testEmptyMultimapReads() {
 Multimap<String, Integer> multimap = ImmutableListMultimap.of();
 assertFalse(multimap.containsKey("foo"));
 assertFalse(multimap.containsValue(1));
 assertFalse(multimap.containsEntry("foo", 1));
 assertTrue(multimap.entries().isEmpty());
 assertTrue(multimap.equals(ArrayListMultimap.create()));
 assertEquals(Collections.emptyList(), multimap.get("foo"));
 assertEquals(0, multimap.hashCode());
 assertTrue(multimap.isEmpty());
 assertEquals(HashMultiset.create(), multimap.keys());
 assertEquals(Collections.emptySet(), multimap.keySet());
 assertEquals(0, multimap.size());
 assertTrue(multimap.values().isEmpty());
 assertEquals("{}", multimap.toString());
}

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

public void testMultimapReads() {
 Multimap<String, Integer> multimap = createMultimap();
 assertTrue(multimap.containsKey("foo"));
 assertFalse(multimap.containsKey("cat"));
 assertTrue(multimap.containsValue(1));
 assertFalse(multimap.containsValue(5));
 assertTrue(multimap.containsEntry("foo", 1));
 assertFalse(multimap.containsEntry("cat", 1));
 assertFalse(multimap.containsEntry("foo", 5));
 assertFalse(multimap.entries().isEmpty());
 assertEquals(3, multimap.size());
 assertFalse(multimap.isEmpty());
 assertEquals("{foo=[1, 3], bar=[2]}", multimap.toString());
}

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

public void testMultimapReads() {
 Multimap<String, Integer> multimap = createMultimap();
 assertTrue(multimap.containsKey("foo"));
 assertFalse(multimap.containsKey("cat"));
 assertTrue(multimap.containsValue(1));
 assertFalse(multimap.containsValue(5));
 assertTrue(multimap.containsEntry("foo", 1));
 assertFalse(multimap.containsEntry("cat", 1));
 assertFalse(multimap.containsEntry("foo", 5));
 assertFalse(multimap.entries().isEmpty());
 assertEquals(3, multimap.size());
 assertFalse(multimap.isEmpty());
 assertEquals("{foo=[1, 3], bar=[2]}", multimap.toString());
}

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

assertEquals(multimap.size(), multimapView.size());
assertTrue(multimapView.containsKey("foo"));
assertTrue(multimapView.containsValue(1));
assertTrue(multimapView.containsEntry("bar", 2));
assertEquals(Collections.singleton(1), multimapView.get("foo"));

相关文章