diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-01-31 08:29:07 +0100 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-01-31 08:29:07 +0100 |
commit | 4ee5b8e3566f7ef431f22a6f4830a19fb9941049 (patch) | |
tree | da54936b4bff211a5456368d5a1fec579b504102 /document | |
parent | 2bc272cfa07be3102f531ec08c15b012f8cc2abf (diff) |
Let IntelliJ implement equals() and hashCode().
Diffstat (limited to 'document')
-rw-r--r-- | document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java b/document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java index 797a9d96a1a..bfa6c2b916b 100644 --- a/document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java +++ b/document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java @@ -7,6 +7,8 @@ import com.yahoo.document.datatypes.FieldValue; import com.yahoo.document.datatypes.TensorFieldValue; import com.yahoo.document.serialization.DocumentUpdateWriter; +import java.util.Objects; + /* * An update for the subset of the cells in a tensor. * The tensor is a mapped (aka sparse) tensor. @@ -51,13 +53,17 @@ public class TensorModifyUpdate extends ValueUpdate<TensorFieldValue> { @Override public boolean equals(Object o) { - return o instanceof TensorModifyUpdate && super.equals(o) && - operation == ((TensorModifyUpdate) o).operation && tensor.equals(((TensorModifyUpdate) o).tensor); + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + TensorModifyUpdate that = (TensorModifyUpdate) o; + return operation == that.operation && + tensor.equals(that.tensor); } @Override public int hashCode() { - return super.hashCode() + operation.hashCode() + tensor.hashCode(); + return Objects.hash(super.hashCode(), operation, tensor); } @Override |