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

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

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

Multiset.containsAll介绍

[英]Returns true if this multiset contains at least one occurrence of each element in the specified collection.

This method refines Collection#containsAll to further specify that it may not throw an exception in response to any of elements being null or of the wrong type.

Note: this method does not take into account the occurrence count of an element in the two collections; it may still return true even if elements contains several occurrences of an element and this multiset contains only one. This is no different than any other collection type like List, but it may be unexpected to the user of a multiset.
[中]如果此多集包含指定集合中每个元素的至少一个匹配项,则返回true。
此方法细化了集合#containsAll,以进一步指定它不会在响应任何元素为null或类型错误时引发异常。
注意:此方法不考虑两个集合中某个元素的出现次数;即使元素包含一个元素的多个实例,且此多集仅包含一个,它仍可能返回true。这与任何其他集合类型(如列表)没有什么不同,但对于multiset的用户来说可能是意外的。

代码示例

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

@Override
public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override
public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override
public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@CollectionSize.Require(absent = ZERO)
 public void testContainsAllListIgnoresFrequency() {
  assertTrue(getMultiset().containsAll(Arrays.asList(e0(), e0(), e0())));
 }
}

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

@CollectionSize.Require(absent = ZERO)
public void testContainsAllMultisetIgnoresFrequency() {
 assertTrue(getMultiset().containsAll(getSubjectGenerator().create(e0(), e0(), e0())));
}

代码示例来源:origin: aadnk/ProtocolLib

@Override
public boolean containsAll(Collection<?> arg0) {
  return multiset.containsAll(arg0);
}

代码示例来源:origin: com.atlassian.bundles/guava

@Override public boolean containsAll(Collection<?> c) {
 return multiset.containsAll(c);
}

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

@Override
public boolean containsAll(Collection<?> c) {
  return multiset().containsAll(c);
}

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

@Override public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override
public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override
public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@Override public boolean containsAll(Collection<?> c) {
 return multiset().containsAll(c);
}

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

@CollectionSize.Require(absent = ZERO)
 public void testContainsAllListIgnoresFrequency() {
  assertTrue(getMultiset().containsAll(Arrays.asList(samples.e0, samples.e0, samples.e0)));
 }
}

代码示例来源:origin: org.ow2.authzforce/authzforce-ce-core-pdp-api

private static <V extends AttributeValue> boolean eval(final Bag<V> bag0, final Bag<V> bag1)
{
  return bag1.elements().containsAll(bag0.elements());
}

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

@CollectionSize.Require(absent = ZERO)
 public void testContainsAllListIgnoresFrequency() {
  assertTrue(getMultiset().containsAll(Arrays.asList(e0(), e0(), e0())));
 }
}

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

@CollectionSize.Require(absent = ZERO)
public void testContainsAllMultisetIgnoresFrequency() {
 assertTrue(getMultiset()
   .containsAll(getSubjectGenerator().create(samples.e0, samples.e0, samples.e0)));
}

代码示例来源:origin: cinchapi/concourse

@Test
public void testKeysContainsAll() {
  multimap.put("foo", 1);
  multimap.put("foo", 5);
  multimap.put("foo", nullValue());
  multimap.put(nullKey(), 3);
  Multiset<String> multiset = multimap.keys();
  assertTrue(multiset.containsAll(asList("foo", nullKey())));
  assertFalse(multiset.containsAll(asList("foo", "bar")));
}

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

@CollectionSize.Require(absent = ZERO)
public void testContainsAllMultisetIgnoresFrequency() {
 assertTrue(getMultiset().containsAll(getSubjectGenerator().create(e0(), e0(), e0())));
}

相关文章