本文整理了Java中com.google.common.collect.Multiset.toString()
方法的一些代码示例,展示了Multiset.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Multiset.toString()
方法的具体详情如下:
包路径:com.google.common.collect.Multiset
类名称:Multiset
方法名:toString
[英]It is recommended, though not mandatory, that this method return the result of invoking #toString on the #entrySet, yielding a result such as [a x 3, c, d x 2, e].
[中]尽管不是强制性的,但建议该方法返回调用#entrySet上的#toString的结果,从而产生[a x 3,c,d x 2,e]等结果。
代码示例来源:origin: google/guava
public void testToString() {
assertEquals(getMultiset().entrySet().toString(), getMultiset().toString());
}
}
代码示例来源:origin: google/guava
public void testToString() {
Multiset<String> ms = TreeMultiset.create();
ms.add("a", 3);
ms.add("c", 1);
ms.add("b", 2);
assertEquals("[a x 3, b x 2, c]", ms.toString());
}
代码示例来源:origin: google/guava
public void testToString() {
Multiset<String> ms = LinkedHashMultiset.create();
ms.add("a", 3);
ms.add("c", 1);
ms.add("b", 2);
assertEquals("[a x 3, c, b x 2]", ms.toString());
}
代码示例来源:origin: google/guava
public void testToString() {
Multiset<Color> ms = EnumMultiset.create(Color.class);
ms.add(Color.BLUE, 3);
ms.add(Color.YELLOW, 1);
ms.add(Color.RED, 2);
assertEquals("[BLUE x 3, RED x 2, YELLOW]", ms.toString());
}
代码示例来源:origin: google/guava
public void testKeysToString_ordering() {
Multimap<String, Integer> multimap = initializeMultimap5();
assertEquals("[foo x 2, bar x 2, cow]", multimap.keys().toString());
}
代码示例来源:origin: google/guava
public void testCreateWithComparator() {
Multiset<String> multiset = TreeMultiset.create(Collections.reverseOrder());
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: google/guava
public void testCreate() {
Multiset<String> multiset = LinkedHashMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: google/guava
public void testCreateWithSize() {
Multiset<String> multiset = LinkedHashMultiset.create(50);
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: google/guava
public void testCreateFromIterable() {
Multiset<String> multiset = LinkedHashMultiset.create(Arrays.asList("foo", "bar", "foo"));
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: google/guava
public void testCreateFromIterable() {
Multiset<String> multiset = TreeMultiset.create(Arrays.asList("foo", "bar", "foo"));
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[bar, foo x 2]", multiset.toString());
}
代码示例来源:origin: aadnk/ProtocolLib
@Override
public String toString() {
return multiset.toString();
}
};
代码示例来源:origin: mast-group/tassal
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
for (final Entry<B, Multiset<A>> entry : table.entrySet()) {
sb.append("P(?|" + entry.getKey().toString() + ")="
+ entry.getValue().toString() + "\n");
}
return sb.toString();
}
代码示例来源:origin: cinchapi/concourse
@Override
public boolean equals(Object obj) {
if(obj instanceof Multiset) {
Multiset<?> other = (Multiset<?>) obj;
return toString().equals(other.toString());
}
else {
return false;
}
}
代码示例来源:origin: com.google.guava/guava-tests
public void testToString() {
Multiset<Color> ms = EnumMultiset.create(Color.class);
ms.add(Color.BLUE, 3);
ms.add(Color.YELLOW, 1);
ms.add(Color.RED, 2);
assertEquals("[BLUE x 3, RED x 2, YELLOW]", ms.toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testToString() {
Multiset<String> ms = LinkedHashMultiset.create();
ms.add("a", 3);
ms.add("c", 1);
ms.add("b", 2);
assertEquals("[a x 3, c, b x 2]", ms.toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testKeysToString_ordering() {
Multimap<String, Integer> multimap = initializeMultimap5();
assertEquals("[foo x 2, bar x 2, cow]", multimap.keys().toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testCreate() {
Multiset<String> multiset = LinkedHashMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testCreateWithSize() {
Multiset<String> multiset = LinkedHashMultiset.create(50);
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testCreateFromIterable() {
Multiset<String> multiset
= LinkedHashMultiset.create(Arrays.asList("foo", "bar", "foo"));
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[foo x 2, bar]", multiset.toString());
}
代码示例来源:origin: com.google.guava/guava-tests
public void testCreateFromIterable() {
Multiset<String> multiset
= TreeMultiset.create(Arrays.asList("foo", "bar", "foo"));
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals("[bar, foo x 2]", multiset.toString());
}
内容来源于网络,如有侵权,请联系作者删除!