public DocumentUpdate applyTo(Document doc) {
        verifyType(doc);

        for (FieldUpdate fieldUpdate : id2FieldUpdates.values()) {
            fieldUpdate.applyTo(doc);
        }
        for (FieldPathUpdate fieldPathUpdate : fieldPathUpdates) {
            fieldPathUpdate.applyTo(doc);
        }
        return this;
    }
Applies this document update.

@param doc the document to apply the update to
@return a reference to itself
@throws IllegalArgumentException if the document does not have the same document type as this update
document/src/main/java/com/yahoo/document/DocumentUpdate.java