# Class GenericQuerySnapshot&lt;QueryT&gt; (3.43.1)

3.43.1 (latest) 3.41.0 3.38.0 3.37.0 3.36.0 3.35.1 3.33.4 3.32.2 3.31.9 3.30.11 3.28.0 3.27.2 3.26.5 3.25.1 3.24.3 3.22.0 3.21.4 3.20.0 3.17.0 3.16.3 3.15.7 3.14.4 3.13.2 3.12.1 3.11.0 3.10.0 3.9.6 3.8.2 3.7.10 3.6.0 3.5.0 3.4.2 3.3.0 3.2.0 3.1.0 3.0.21

    public abstract class GenericQuerySnapshot<QueryT> implements Iterable<QueryDocumentSnapshot>

Abstract. A GenericQuerySnapshot represents the results of a query that returns documents. It can
contain zero or more DocumentSnapshot objects.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GenericQuerySnapshot\<QueryT\>

## Implements

[Iterable\<QueryDocumentSnapshot\>](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable<com/google/cloud/firestore/QueryDocumentSnapshot>.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `QueryT` |   |

## Constructors

### GenericQuerySnapshot(QueryT query, Timestamp readTime, List\<QueryDocumentSnapshot\> documents, List\<DocumentChange\> documentChanges)

    protected GenericQuerySnapshot(QueryT query, Timestamp readTime, List<QueryDocumentSnapshot> documents, List<DocumentChange> documentChanges)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `query` | `QueryT` |
| `readTime` | `com.google.cloud.Timestamp` |
| `documents` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.QueryDocumentSnapshot>` |
| `documentChanges` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentChange>` |

## Fields

### query

    protected final QueryT query

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `QueryT` |   |

### readTime

    protected final Timestamp readTime

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `clazz` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` The POJO type used to convert the documents in the list. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<T>` |   |

### equals(Object o)

    public boolean equals(Object o)

Tests for equality with this object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `o` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` is tested for equality with this object. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if equal, otherwise `false` |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### getDocumentChanges()

    public 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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentChange>` | The list of documents that changed since the last snapshot. |

### getDocuments()

    public List<QueryDocumentSnapshot> getDocuments()

Returns the documents in this QuerySnapshot as a List in order of the query.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.QueryDocumentSnapshot>` | The list of documents. |

### getQuery()

    public QueryT getQuery()

Returns the query for the snapshot.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `QueryT` | The backing query that produced this snapshot. |

### getReadTime()

    public Timestamp getReadTime()

Returns the time at which this snapshot was read.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.Timestamp` | The read time of this snapshot. |

### hashCode()

    public int hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)

### isEmpty()

    public boolean isEmpty()

Returns true if there are no documents in the QuerySnapshot.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### iterator()

    public Iterator<QueryDocumentSnapshot> iterator()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.QueryDocumentSnapshot>` |   |

### size()

    public int size()

Returns the number of DocumentSnapshots in this snapshot.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### toString()

    public String toString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)