本文整理了Java中com.google.common.collect.Multimap.equals()
方法的一些代码示例,展示了Multimap.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Multimap.equals()
方法的具体详情如下:
包路径:com.google.common.collect.Multimap
类名称:Multimap
方法名:equals
[英]Compares the specified object with this multimap for equality. Two multimaps are equal when their map views, as returned by #asMap, are also equal.
In general, two multimaps with identical key-value mappings may or may not be equal, depending on the implementation. For example, two SetMultimap instances with the same key-value mappings are equal, but equality of two ListMultimap instances depends on the ordering of the values for each key.
A non-empty SetMultimap cannot be equal to a non-empty ListMultimap, since their #asMap views contain unequal collections as values. However, any two empty multimaps are equal, because they both have empty #asMap views.
[中]将指定的对象与此多重映射进行相等性比较。当#asMap返回的地图视图相同时,两个多重地图是相等的。
通常,两个具有相同键值映射的多重映射可能相等,也可能不相等,具体取决于实现。例如,具有相同键值映射的两个SetMultimap实例相等,但两个ListMultimap实例相等取决于每个键的值顺序。
非空SetMultimap不能等于非空ListMultimap,因为它们的#asMap视图包含不相等的集合作为值。但是,任何两个空多重贴图都是相等的,因为它们都有空的#asMap视图。
代码示例来源:origin: google/guava
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
synchronized (mutex) {
return delegate().equals(o);
}
}
代码示例来源:origin: apache/hive
@Override public boolean equals(Object obj) {
return obj == this
|| obj instanceof CorelMap
&& mapRefRelToCorRef.equals(((CorelMap) obj).mapRefRelToCorRef)
&& mapCorToCorRel.equals(((CorelMap) obj).mapCorToCorRel)
&& mapFieldAccessToCorRef.equals(
((CorelMap) obj).mapFieldAccessToCorRef);
}
代码示例来源:origin: google/j2objc
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
synchronized (mutex) {
return delegate().equals(o);
}
}
代码示例来源:origin: google/guava
@Override
public boolean equals(@Nullable Object object) {
return object == this || delegate().equals(object);
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
synchronized (mutex) {
return delegate().equals(o);
}
}
代码示例来源:origin: google/guava
public void testEmptyMultimapsEqual() {
Multimap<String, Integer> setMultimap = HashMultimap.create();
Multimap<String, Integer> listMultimap = ArrayListMultimap.create();
assertTrue(setMultimap.equals(listMultimap));
assertTrue(listMultimap.equals(setMultimap));
}
}
代码示例来源:origin: google/j2objc
@Override
public boolean equals(@NullableDecl Object object) {
return object == this || delegate().equals(object);
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean equals(@NullableDecl Object object) {
return object == this || delegate().equals(object);
}
代码示例来源: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 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
Multimap<String, Integer> multimap2 = HashMultimap.create();
multimap2.put("foo", 1);
assertFalse(multimapView.equals(multimap2));
multimap2.put("bar", 1);
assertFalse(multimapView.equals(multimap2));
ListMultimap<String, Integer> listMultimap =
new ImmutableListMultimap.Builder<String, Integer>().put("foo", 1).put("bar", 2).build();
assertFalse("SetMultimap equals ListMultimap", multimapView.equals(listMultimap));
assertEquals(multimap.hashCode(), multimapView.hashCode());
assertEquals(multimap.size(), multimapView.size());
代码示例来源:origin: apache/metron
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BulkWriterResponse that = (BulkWriterResponse) o;
if (!errors.equals(that.errors)) return false;
return successes.equals(that.successes);
}
代码示例来源:origin: linkedin/indextank-engine
if (other.filteringFacets != null)
return false;
} else if (!filteringFacets.equals(other.filteringFacets))
return false;
if (now != other.now)
代码示例来源:origin: com.lmco.shindig/shindig-gadgets
@Override
public boolean equals(Object obj) {
if (obj == this) { return true; }
if (!(obj instanceof HttpResponse)) { return false; }
HttpResponse response = (HttpResponse)obj;
return httpStatusCode == response.httpStatusCode &&
headers.equals(response.headers) &&
Arrays.equals(responseBytes, response.responseBytes);
}
代码示例来源:origin: Qihoo360/Quicksql
@Override public boolean equals(Object obj) {
return obj == this
|| obj instanceof CorelMap
&& mapRefRelToCorRef.equals(((CorelMap) obj).mapRefRelToCorRef)
&& mapCorToCorRel.equals(((CorelMap) obj).mapCorToCorRel)
&& mapFieldAccessToCorRef.equals(
((CorelMap) obj).mapFieldAccessToCorRef);
}
代码示例来源:origin: caskdata/cdap
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ResourceAssignment other = (ResourceAssignment) o;
return name.equals(other.name) && assignments.equals(other.assignments);
}
代码示例来源:origin: com.github.akiellor.jasmine/jasmine-cli
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Summary summary = (Summary) o;
if (descriptions != null ? !descriptions.equals(summary.descriptions) : summary.descriptions != null)
return false;
if (failures != null ? !failures.equals(summary.failures) : summary.failures != null) return false;
return true;
}
代码示例来源:origin: org.hudsonci.lib.guava/guava
@Override public boolean equals(Object o) {
if (o == this) {
return true;
}
synchronized (mutex) {
return delegate().equals(o);
}
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GetJobListOptions options = (GetJobListOptions) o;
return buildQueryParameters().equals(options.buildQueryParameters());
}
代码示例来源:origin: jclouds/legacy-jclouds
@Override
public boolean apply(IpPermission arg0) {
return arg0.getUserIdGroupPairs().equals(ImmutableMultimap.of(group.getOwnerId(), group1Name));
}
}));
内容来源于网络,如有侵权,请联系作者删除!