This is useful in the context of FileVault for this algorithm:
- get the NodeDefinition of the child node that is to be deleted.
- loop through all child nodes and count the ones that have the same nodedef. To compare that the nodedef is same, it was recommended to add an equals method in ItemDefinitionImpl as per the conversation done on PR https://github.com/apache/jackrabbit-filevault/pull/163#discussion_r711728698
- if the nodedef is mandatory and there are more than 1 nodes with this nodedef, we can delete it.