java.util.Map.equals()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(163)

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

Map.equals介绍

[英]Compares the argument to the receiver, and returns true if the specified object is a Map and both Maps contain the same mappings.
[中]将参数与接收器进行比较,如果指定的对象是映射且两个映射包含相同的映射,则返回true。

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 // TODO: why not allow equality to non-HashIndex indices?
 if (!(o instanceof HashIndex)) return false;
 HashIndex hashIndex = (HashIndex) o;
 return indexes.equals(hashIndex.indexes) && objects.equals(hashIndex.objects);
}

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

@Override
  public boolean equals(Object other) {
    if (this == other) {
      return true;
    } else if (other == null || getClass() != other.getClass()) {
      return false;
    }
    Summary summary = (Summary) other;
    return transformed.equals(summary.transformed)
        && failed.equals(summary.failed)
        && unresolved.equals(summary.unresolved);
  }
}

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

@Override
public boolean equals(Object obj) {
  if (obj == this) return true;
  if (obj instanceof ReplicaSets) {
    ReplicaSets that = (ReplicaSets) obj;
    return this.replicaSetsByName.equals(that.replicaSetsByName) && this.nonReplicaSets.equals(that.nonReplicaSets);
  }
  return false;
}

代码示例来源:origin: apache/incubator-druid

@Override
public boolean equals(Object o)
{
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 RowSignature that = (RowSignature) o;
 if (columnTypes != null ? !columnTypes.equals(that.columnTypes) : that.columnTypes != null) {
  return false;
 }
 return columnNames != null ? columnNames.equals(that.columnNames) : that.columnNames == null;
}

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

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 InstrumentationConfiguration that = (InstrumentationConfiguration) o;
 if (!classNameTranslations.equals(that.classNameTranslations)) return false;
 if (!classesToNotAcquire.equals(that.classesToNotAcquire)) return false;
 if (!instrumentedPackages.equals(that.instrumentedPackages)) return false;
 if (!instrumentedClasses.equals(that.instrumentedClasses)) return false;
 if (!interceptedMethods.equals(that.interceptedMethods)) return false;
 return true;
}

代码示例来源:origin: apollographql/apollo-android

@Override public boolean equals(Object o) {
 if (this == o) return true;
 if (!(o instanceof Error)) return false;
 Error error = (Error) o;
 if (message != null ? !message.equals(error.message) : error.message != null) return false;
 if (!locations.equals(error.locations)) return false;
 return customAttributes.equals(error.customAttributes);
}

代码示例来源:origin: joelittlejohn/jsonschema2pojo

@Override
public boolean equals(Object other) {
  if (other == this) {
    return true;
  }
  if ((other instanceof Address) == false) {
    return false;
  }
  Address rhs = ((Address) other);
  return ((((((((((this.postOfficeBox == rhs.postOfficeBox)||((this.postOfficeBox!= null)&&this.postOfficeBox.equals(rhs.postOfficeBox)))&&((this.address == rhs.address)||((this.address!= null)&&this.address.equals(rhs.address))))&&((this.streetAddress == rhs.streetAddress)||((this.streetAddress!= null)&&this.streetAddress.equals(rhs.streetAddress))))&&((this.postalCode == rhs.postalCode)||((this.postalCode!= null)&&this.postalCode.equals(rhs.postalCode))))&&((this.locality == rhs.locality)||((this.locality!= null)&&this.locality.equals(rhs.locality))))&&((this.countryName == rhs.countryName)||((this.countryName!= null)&&this.countryName.equals(rhs.countryName))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.extendedAddress == rhs.extendedAddress)||((this.extendedAddress!= null)&&this.extendedAddress.equals(rhs.extendedAddress))))&&((this.region == rhs.region)||((this.region!= null)&&this.region.equals(rhs.region))));
}

代码示例来源:origin: apache/incubator-druid

@Override
public boolean equals(Object o)
{
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 SelectResultValue that = (SelectResultValue) o;
 if (events != null ? !events.equals(that.events) : that.events != null) {
  return false;
 }
 if (dimensions != null ? !dimensions.equals(that.dimensions) : that.dimensions != null) {
  return false;
 }
 if (metrics != null ? !metrics.equals(that.metrics) : that.metrics != null) {
  return false;
 }
 if (pagingIdentifiers != null
   ? !pagingIdentifiers.equals(that.pagingIdentifiers)
   : that.pagingIdentifiers != null) {
  return false;
 }
 return true;
}

代码示例来源:origin: apache/incubator-gobblin

@Override
public boolean equals(Object object) {
 if (!(object instanceof SourceState)) {
  return false;
 }
 SourceState other = (SourceState) object;
 return super.equals(other) && this.previousDatasetStatesByUrns.equals(other.previousDatasetStatesByUrns)
   && this.previousWorkUnitStates.equals(other.previousWorkUnitStates);
}

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

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  BuildCommand that = (BuildCommand) o;
  if (name != null ? !name.equals(that.name) : that.name != null) return false;
  if (args != null ? !args.equals(that.args) : that.args != null) return false;
  if (subCommands != null ? !subCommands.equals(that.subCommands) : that.subCommands != null) return false;
  if (workingDirectory != null ? !workingDirectory.equals(that.workingDirectory) : that.workingDirectory != null)
    return false;
  if (test != null ? !test.equals(that.test) : that.test != null) return false;
  if (runIfConfig != null ? !runIfConfig.equals(that.runIfConfig) : that.runIfConfig != null) return false;
  return onCancel != null ? onCancel.equals(that.onCancel) : that.onCancel == null;
}

代码示例来源:origin: org.apache.avro/avro

public boolean equals(Object o) {
 if (o == this) return true;
 if (!(o instanceof UnionSchema)) return false;
 UnionSchema that = (UnionSchema)o;
 return equalCachedHash(that)
  && types.equals(that.types)
  && props.equals(that.props);
}
@Override int computeHash() {

代码示例来源:origin: Mojang/brigadier

@Override
public boolean equals(final Object o) {
  if (this == o) return true;
  if (!(o instanceof CommandContext)) return false;
  final CommandContext that = (CommandContext) o;
  if (!arguments.equals(that.arguments)) return false;
  if (!rootNode.equals(that.rootNode)) return false;
  if (nodes.size() != that.nodes.size() || !nodes.equals(that.nodes)) return false;
  if (command != null ? !command.equals(that.command) : that.command != null) return false;
  if (!source.equals(that.source)) return false;
  if (child != null ? !child.equals(that.child) : that.child != null) return false;
  return true;
}

代码示例来源:origin: stanfordnlp/CoreNLP

if (!modelMetaData.equals(other.modelMetaData)) {
 return false;
if (!variableMetaData.equals(other.variableMetaData)) {
 return false;

代码示例来源:origin: apache/flink

@Override
public boolean equals(Object o) {
  if (this == o) { return true; }
  if (o == null || getClass() != o.getClass()) { return false; }
  SimpleWithNestedInterfaces that = (SimpleWithNestedInterfaces) o;
  if (!list.equals(that.list)) { return false; }
  if (!map1.equals(that.map1)) { return false; }
  return true;
}

代码示例来源:origin: org.apache.avro/avro

public boolean equals(Object o) {
 if (o == this) return true;
 if (!(o instanceof EnumSchema)) return false;
 EnumSchema that = (EnumSchema)o;
 return equalCachedHash(that)
  && equalNames(that)
  && symbols.equals(that.symbols)
  && props.equals(that.props);
}
@Override int computeHash() { return super.computeHash() + symbols.hashCode(); }

代码示例来源:origin: apache/avro

@Override
 public boolean equals(Object o) {
  if (!(o instanceof R1)) return false;
  R1 that = (R1)o;
  return mapField.equals(that.mapField)
   && Arrays.equals(this.arrayField, that.arrayField)
   &&  listField.equals(that.listField);
 }
}

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

@Override
public boolean equals(Object o)
{
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  PojoWithHashMapInnerKeySetAsDelegate that = (PojoWithHashMapInnerKeySetAsDelegate) o;
  if (list != null ? !list.equals(that.list) : that.list != null) return false;
  if (map != null ? !map.equals(that.map) : that.map != null) return false;
  return set != null ? set.equals(that.set) : that.set == null;
}

代码示例来源:origin: com.google.protobuf/protobuf-java

@java.lang.Override
public boolean equals(final java.lang.Object obj) {
 if (obj == this) {
  return true;
 }
 if (!(obj instanceof com.google.protobuf.DescriptorProtos.OneofOptions)) {
  return super.equals(obj);
 }
 com.google.protobuf.DescriptorProtos.OneofOptions other = (com.google.protobuf.DescriptorProtos.OneofOptions) obj;
 boolean result = true;
 result = result && getUninterpretedOptionList()
   .equals(other.getUninterpretedOptionList());
 result = result && unknownFields.equals(other.unknownFields);
 result = result &&
   getExtensionFields().equals(other.getExtensionFields());
 return result;
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  if (!super.equals(o)) return false;
  ExternalIdentityProviderDefinition that = (ExternalIdentityProviderDefinition) o;
  if (addShadowUserOnLogin != that.addShadowUserOnLogin) return false;
  if(this.isStoreCustomAttributes() != that.isStoreCustomAttributes()) return false;
  if (getExternalGroupsWhitelist() != null ? !getExternalGroupsWhitelist().equals(that.getExternalGroupsWhitelist()) : that.getExternalGroupsWhitelist() != null)
    return false;
  return attributeMappings != null ? attributeMappings.equals(that.attributeMappings) : that.attributeMappings == null;
}

代码示例来源:origin: com.google.protobuf/protobuf-java

@java.lang.Override
public boolean equals(final java.lang.Object obj) {
 if (obj == this) {
  return true;
 }
 if (!(obj instanceof com.google.protobuf.DescriptorProtos.ExtensionRangeOptions)) {
  return super.equals(obj);
 }
 com.google.protobuf.DescriptorProtos.ExtensionRangeOptions other = (com.google.protobuf.DescriptorProtos.ExtensionRangeOptions) obj;
 boolean result = true;
 result = result && getUninterpretedOptionList()
   .equals(other.getUninterpretedOptionList());
 result = result && unknownFields.equals(other.unknownFields);
 result = result &&
   getExtensionFields().equals(other.getExtensionFields());
 return result;
}

相关文章