private DocumentChange addDoc ( QueryDocumentSnapshot newDocument ) { ResourcePath resourcePath = newDocument . getReference ( ) . getResourcePath ( ) ; documentSet = documentSet . add ( newDocument ) ; int newIndex = documentSet . indexOf ( resourcePath ) ; return new DocumentChange ( newDocument , Type . ADDED , - 1 , newIndex ) ; }
Applies a document add to the document tree . Returns the corresponding DocumentChange event .