Simplify if statements

See gh-17785
This commit is contained in:
SaberXu
2019-08-05 22:56:13 +08:00
committed by Stephane Nicoll
parent 3efead4ba5
commit c6c3a91f8d
5 changed files with 9 additions and 24 deletions

View File

@@ -165,7 +165,7 @@ public class ConfigurationMetadata {
if (o1 == o2) {
return true;
}
return o1 != null && o2 != null && o1.equals(o2);
return o1 != null && o1.equals(o2);
}
public static String nestedPrefix(String prefix, String name) {

View File

@@ -157,10 +157,7 @@ public final class Metadata {
if (this.deprecation == null && itemMetadata.getDeprecation() != null) {
return false;
}
if (this.deprecation != null && !this.deprecation.equals(itemMetadata.getDeprecation())) {
return false;
}
return true;
return this.deprecation == null || this.deprecation.equals(itemMetadata.getDeprecation());
}
public MetadataItemCondition ofType(Class<?> dataType) {
@@ -342,10 +339,7 @@ public final class Metadata {
if (this.value != null && !this.value.equals(valueHint.getValue())) {
return false;
}
if (this.description != null && !this.description.equals(valueHint.getDescription())) {
return false;
}
return true;
return this.description == null || this.description.equals(valueHint.getDescription());
}
}