Class DocumentChange (3.14.4)

public class DocumentChange

A DocumentChange represents a change to the documents matching a query. It contains the document affected and a the type of change that occurred (added, modifed, or removed).

Inheritance

Object > DocumentChange

Methods

equals(Object obj)

public boolean equals(Object obj)

Returns true if this DocumentChange is equal to the provided object.

Parameter
NameDescription
objObject

The object to compare against.

Returns
TypeDescription
boolean

Whether this DocumentChange is equal to the provided object.

Overrides

getDocument()

public QueryDocumentSnapshot getDocument()

Returns the newly added or modified document if this DocumentChange is for an updated document. Returns the deleted document if this document change represents a removal.

Returns
TypeDescription
QueryDocumentSnapshot

A snapshot of the new data (for Type.ADDED or Type.MODIFIED) or the removed data (for Type.REMOVED).

getNewIndex()

public int getNewIndex()

The index of the changed document in the result set immediately after this DocumentChange (i.e. supposing that all prior DocumentChange objects and the current DocumentChange object have been applied). Returns -1 for 'removed' events.

Returns
TypeDescription
int

getOldIndex()

public int getOldIndex()

The index of the changed document in the result set immediately prior to this DocumentChange (i.e. supposing that all prior DocumentChange objects have been applied). Returns -1 for 'added' events.

Returns
TypeDescription
int

getType()

public DocumentChange.Type getType()
Returns
TypeDescription
DocumentChange.Type

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides