equals method can be simplified

This commit is contained in:
vyacheslav.raskulin 2020-09-09 14:46:46 +03:00
parent 73f9a82938
commit 96b2094370
2 changed files with 5 additions and 3 deletions

View file

@ -7,6 +7,8 @@
package org.mage.plugins.card.dl.beans.properties;
import java.util.Objects;
import static java.lang.String.*;
@ -28,7 +30,7 @@ public abstract class AbstractProperty<T> implements Property<T> {
if(!(obj instanceof Property<?>)) return false;
Object value = getValue();
Object other = ((Property<?>) obj).getValue();
return value == other || (value != null && value.equals(other));
return Objects.equals(value, other);
}
@Override

View file

@ -88,10 +88,10 @@ public class CardDownloadData {
return false;
}
final CardDownloadData other = (CardDownloadData) obj;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
if (!Objects.equals(this.name, other.name)) {
return false;
}
if ((this.set == null) ? (other.set != null) : !this.set.equals(other.set)) {
if (!Objects.equals(this.set, other.set)) {
return false;
}
if (!Objects.equals(this.collectorId, other.collectorId) && (this.collectorId == null || !this.collectorId.equals(other.collectorId))) {