private void validateThatLeafGroupsHasEqualNumberOfNodes() {
        if (dispatchPolicy != DispatchTuning.DispatchPolicy.ROUNDROBIN) return;

        StorageGroup previousGroup = null;
        for (StorageGroup group : rootGroup.getSubgroups()) {
            if (previousGroup == null) { // first group
                previousGroup = group;
                continue;
            }

            if (group.getNodes().size() != previousGroup.getNodes().size())
                throw new IllegalArgumentException("Expected leaf groups to contain an equal number of nodes, but leaf group '" +
                                                   previousGroup.getName() + "' contains " + previousGroup.getNodes().size() +
                                                   " node(s) while leaf group '" + group.getName() +
                                                   "' contains " + group.getNodes().size() + " node(s)");
            previousGroup = group;
        }
    }
Class used to validate that hierarchic distribution is correctly setup when having an indexed content cluster.

Note that this class does not implement the com.yahoo.vespa.model.application.validation.Validator interface,
but is instead used in the context of com.yahoo.vespa.model.ConfigProducer.validate() such that it can be unit tested
without having to build the complete vespa model.

@author geirst
config-model/src/main/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionValidator.java