Skip to content

Commit 8298296

Browse files
committed
SQLiteRemoteDocumentCache.java: implement equals() and hashCode() in BackfillKey
1 parent 8df2f53 commit 8298296

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteRemoteDocumentCache.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.util.Iterator;
4545
import java.util.List;
4646
import java.util.Map;
47+
import java.util.Objects;
4748
import java.util.Set;
4849
import java.util.concurrent.ConcurrentHashMap;
4950
import java.util.concurrent.Executor;
@@ -488,6 +489,25 @@ private static class BackfillKey {
488489
this.readTimeNanos = readTimeNanos;
489490
}
490491

492+
@Override
493+
public boolean equals(Object object) {
494+
if (object == this) {
495+
return true;
496+
}
497+
if (!(object instanceof BackfillKey)) {
498+
return false;
499+
}
500+
BackfillKey other = (BackfillKey) object;
501+
return readTimeSeconds == other.readTimeSeconds
502+
&& readTimeNanos == other.readTimeNanos
503+
&& Objects.equals(path, other.path);
504+
}
505+
506+
@Override
507+
public int hashCode() {
508+
return Objects.hash(path, readTimeSeconds, readTimeNanos);
509+
}
510+
491511
@NonNull
492512
@Override
493513
public String toString() {

0 commit comments

Comments
 (0)