private ChangeSet extractChanges ( Timestamp readTime ) { ChangeSet changeSet = new ChangeSet ( ) ; for ( Entry < ResourcePath , Document > change : changeMap . entrySet ( ) ) { if ( change . getValue ( ) == null ) { if ( documentSet . contains ( change . getKey ( ) ) ) { changeSet . deletes . add ( documentSet . getDocument ( change . getKey ( ) ) ) ; } continue ; } QueryDocumentSnapshot snapshot = QueryDocumentSnapshot . fromDocument ( firestore , readTime , change . getValue ( ) ) ; if ( documentSet . contains ( change . getKey ( ) ) ) { changeSet . updates . add ( snapshot ) ; } else { changeSet . adds . add ( snapshot ) ; } } return changeSet ; }
Splits up document changes into removals additions and updates .