private List<HostResource> sortedContainerHostsFrom(ContainerModel model, int count, boolean retired) {
        List<HostResource> hosts = model.getCluster().getContainers().stream()
                                                                     .filter(container -> retired == container.isRetired())
                                                                     .map(Container::getHostResource)
                                                                     .sorted(HostResource::comparePrimarilyByIndexTo)
                                                                     .collect(Collectors.toCollection(ArrayList::new));
        return hosts.subList(0, Math.min(count, hosts.size()));
    }
Returns the count first containers in the current model having isRetired set to the given value
config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java