public abstract class QuerySnapshot implements Iterable<QueryDocumentSnapshot>A QuerySnapshot contains the results of a query. It can contain zero or more DocumentSnapshot objects.
Implements
Iterable<QueryDocumentSnapshot>Static Methods
withChanges(Query query, Timestamp readTime, DocumentSet documentSet, List<DocumentChange> documentChanges)
public static QuerySnapshot withChanges(Query query, Timestamp readTime, DocumentSet documentSet, List<DocumentChange> documentChanges)Creates a new QuerySnapshot representing a snapshot of a Query with changed documents.
| Name | Description |
| query | Query |
| readTime | com.google.cloud.Timestamp |
| documentSet | com.google.cloud.firestore.DocumentSet |
| documentChanges | List<DocumentChange> |
| Type | Description |
| QuerySnapshot |
withDocuments(Query query, Timestamp readTime, List<QueryDocumentSnapshot> documents)
public static QuerySnapshot withDocuments(Query query, Timestamp readTime, List<QueryDocumentSnapshot> documents)Creates a new QuerySnapshot representing the results of a Query with added documents.
| Name | Description |
| query | Query |
| readTime | com.google.cloud.Timestamp |
| documents | List<QueryDocumentSnapshot> |
| Type | Description |
| QuerySnapshot |
Constructors
QuerySnapshot(Query query, Timestamp readTime)
protected QuerySnapshot(Query query, Timestamp readTime)| Name | Description |
| query | Query |
| readTime | com.google.cloud.Timestamp |
Methods
<T>toObjects(Class<T> clazz)
public List<T> <T>toObjects(Class<T> clazz)Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.
| Name | Description |
| clazz | Class<T>The POJO type used to convert the documents in the list. |
| Type | Description |
| List<T> |
equals(Object obj)
public abstract boolean equals(Object obj)Returns true if the document data in this QuerySnapshot equals the provided snapshot.
| Name | Description |
| obj | ObjectThe object to compare against. |
| Type | Description |
| boolean | Whether this QuerySnapshot is equal to the provided object. |
getDocumentChanges()
public abstract List<DocumentChange> getDocumentChanges()Returns the list of documents that changed since the last snapshot. If it's the first snapshot all documents will be in the list as added changes.
| Type | Description |
| List<DocumentChange> | The list of documents that changed since the last snapshot. |
getDocuments()
public abstract List<QueryDocumentSnapshot> getDocuments()Returns the documents in this QuerySnapshot as a List in order of the query.
| Type | Description |
| List<QueryDocumentSnapshot> | The list of documents. |
getQuery()
public Query getQuery()Returns the query for the snapshot.
| Type | Description |
| Query | The backing query that produced this snapshot. |
getReadTime()
public Timestamp getReadTime()Returns the time at which this snapshot was read.
| Type | Description |
| com.google.cloud.Timestamp | The read time of this snapshot. |
hashCode()
public abstract int hashCode()| Type | Description |
| int |
isEmpty()
public boolean isEmpty()Returns true if there are no documents in the QuerySnapshot.
| Type | Description |
| boolean |
iterator()
public Iterator<QueryDocumentSnapshot> iterator()| Type | Description |
| Iterator<QueryDocumentSnapshot> |
size()
public abstract int size()Returns the number of documents in the QuerySnapshot.
| Type | Description |
| int |