本文整理了Java中com.google.common.collect.Multiset.isEmpty()
方法的一些代码示例,展示了Multiset.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Multiset.isEmpty()
方法的具体详情如下:
包路径:com.google.common.collect.Multiset
类名称:Multiset
方法名:isEmpty
暂无
代码示例来源:origin: google/guava
@Override
public boolean isEmpty() {
return multiset1.isEmpty() && multiset2.isEmpty();
}
代码示例来源:origin: google/guava
@Override
public boolean isEmpty() {
return multiset1.isEmpty() && multiset2.isEmpty();
}
代码示例来源:origin: google/guava
/** A specialization of {@code addAllImpl} for when {@code elements} is itself a Multiset. */
private static <E> boolean addAllImpl(Multiset<E> self, Multiset<? extends E> elements) {
if (elements.isEmpty()) {
return false;
}
elements.forEachEntry(self::add);
return true;
}
代码示例来源:origin: google/guava
@Override
public boolean isEmpty() {
return multiset().isEmpty();
}
代码示例来源:origin: google/guava
@VisibleForTesting
ImmutableMultiset<E> buildJdkBacked() {
if (contents.isEmpty()) {
return of();
}
return JdkBackedImmutableMultiset.create(contents.entrySet());
}
}
代码示例来源:origin: google/guava
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_multiset_empty() {
Multiset<String> c = HashMultiset.create();
Multiset<String> multiset = ImmutableMultiset.copyOf(c);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_multiset_empty() {
Multiset<String> c = HashMultiset.create();
Multiset<String> multiset = ImmutableSortedMultiset.copyOf(c);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testRemoveOccurrencesMultisetEmpty() {
Multiset<String> multiset = HashMultiset.create();
Multiset<String> toRemove = HashMultiset.create(Arrays.asList("a", "b", "a"));
assertFalse(Multisets.removeOccurrences(multiset, toRemove));
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testRetainEmptyOccurrences() {
Multiset<String> multiset = HashMultiset.create(Arrays.asList("a", "b", "a"));
Multiset<String> toRetain = HashMultiset.create();
assertTrue(Multisets.retainOccurrences(multiset, toRetain));
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Multisets.immutableEntry(e0(), 1),
iterator.next());
assertFalse(
"size 1 multiset.entrySet() iterator.hasNext() returned true after next()",
iterator.hasNext());
iterator.remove();
assertTrue(
"multiset isn't empty after multiset.entrySet() iterator.remove()",
getMultiset().isEmpty());
}
代码示例来源:origin: google/guava
public void testRemoveOccurrencesIterableEmpty() {
Multiset<String> multiset = HashMultiset.create();
Iterable<String> toRemove = Arrays.asList("a", "b", "a");
assertFalse(Multisets.removeOccurrences(multiset, toRemove));
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCreation_emptyArray() {
String[] array = new String[0];
Multiset<String> multiset = ImmutableMultiset.copyOf(array);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCreation_emptyArray() {
String[] array = new String[0];
Multiset<String> multiset = ImmutableSortedMultiset.copyOf(array);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCreation_noArgs() {
Multiset<String> multiset = ImmutableMultiset.of();
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCreation_noArgs() {
Multiset<String> multiset = ImmutableSortedMultiset.of();
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_iterator_empty() {
Iterator<String> iterator = Iterators.emptyIterator();
Multiset<String> multiset = ImmutableMultiset.copyOf(iterator);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_collection_empty() {
// "<String>" is required to work around a javac 1.5 bug.
Collection<String> c = MinimalCollection.<String>of();
Multiset<String> multiset = ImmutableSortedMultiset.copyOf(c);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_collection_empty() {
// "<String>" is required to work around a javac 1.5 bug.
Collection<String> c = MinimalCollection.<String>of();
Multiset<String> multiset = ImmutableMultiset.copyOf(c);
assertTrue(multiset.isEmpty());
}
代码示例来源:origin: google/guava
public void testCopyOf_iterator_empty() {
Iterator<String> iterator = Iterators.emptyIterator();
Multiset<String> multiset = ImmutableSortedMultiset.copyOf(iterator);
assertTrue(multiset.isEmpty());
}
内容来源于网络,如有侵权,请联系作者删除!