diff --git a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FieldValue.java b/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FieldValue.java index 4e7d2ab4a050..3ea8f8c1215c 100644 --- a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FieldValue.java +++ b/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/FieldValue.java @@ -21,6 +21,7 @@ import com.google.firestore.v1beta1.DocumentTransform.FieldTransform; import java.util.Arrays; import java.util.List; +import java.util.Objects; import javax.annotation.Nonnull; /** Sentinel values that can be used when writing document fields with set() or update(). */ @@ -112,6 +113,21 @@ FieldTransform toProto(FieldPath path) { fieldTransform.setAppendMissingElements(encodedElements); return fieldTransform.build(); } + + @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; + } + ArrayUnionFieldValue that = (ArrayUnionFieldValue) o; + return Objects.equals(elements, that.elements); + } } static class ArrayRemoveFieldValue extends FieldValue { @@ -150,6 +166,21 @@ FieldTransform toProto(FieldPath path) { fieldTransform.setRemoveAllFromArray(encodedElements); return fieldTransform.build(); } + + @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; + } + ArrayUnionFieldValue that = (ArrayUnionFieldValue) o; + return Objects.equals(elements, that.elements); + } } private FieldValue() {}