20
20
import java .util .Objects ;
21
21
22
22
/**
23
- * A {@code AggregateQuerySnapshot} contains results of a {@link AggregateQuery}.
23
+ * The results of executing an {@link AggregateQuery}.
24
24
*
25
25
* <p><b>Subclassing Note</b>: Cloud Firestore classes are not meant to be subclassed except for use
26
26
* in test mocks. Subclassing is not supported in production code and new SDK releases may break
@@ -37,25 +37,45 @@ public class AggregateQuerySnapshot {
37
37
this .count = count ;
38
38
}
39
39
40
- /** @return The original {@link AggregateQuery} this snapshot is a result of . */
40
+ /** Returns the query that was executed to produce this result. */
41
41
@ NonNull
42
42
public AggregateQuery getQuery () {
43
43
return query ;
44
44
}
45
45
46
- /** @return The result of a document count aggregation . */
46
+ /** Returns the number of documents in the result set of the query . */
47
47
public long getCount () {
48
48
return count ;
49
49
}
50
50
51
+ /**
52
+ * Compares this object with the given object for equality.
53
+ *
54
+ * <p>This object is considered "equal" to the other object if and only if all of the following
55
+ * conditions are satisfied:
56
+ *
57
+ * <ol>
58
+ * <li>{@code object} is a non-null instance of {@link AggregateQuerySnapshot}.</li>
59
+ * <li>{@code object} has the same {@link AggregateQuery} as this object.</li>
60
+ * <li>{@code object} has the same results as this object.</li>
61
+ * </ol>
62
+ *
63
+ * @param object The object to compare to this object for equality.
64
+ * @return {@code true} if this object is "equal" to the given object, as defined above, or
65
+ * {@code false} otherwise.
66
+ */
51
67
@ Override
52
- public boolean equals (Object o ) {
53
- if (this == o ) return true ;
54
- if (!(o instanceof AggregateQuerySnapshot )) return false ;
55
- AggregateQuerySnapshot snapshot = (AggregateQuerySnapshot ) o ;
56
- return count == snapshot .count && query .equals (snapshot .query );
68
+ public boolean equals (Object object ) {
69
+ if (this == object ) return true ;
70
+ if (!(object instanceof AggregateQuerySnapshot )) return false ;
71
+ AggregateQuerySnapshot other = (AggregateQuerySnapshot ) object ;
72
+ return count == other .count && query .equals (other .query );
57
73
}
58
74
75
+ /**
76
+ * Calculates and returns the hash code for this object.
77
+ * @return the hash code for this object.
78
+ */
59
79
@ Override
60
80
public int hashCode () {
61
81
return Objects .hash (count , query );
0 commit comments