code: List<RepositoryResource> createInstallList(SampleResource resource) {
          Map<String, Integer> maxDistanceMap = new HashMap<>();
          List<MissingRequirement> missingRequirements = new ArrayList<>();
  
          boolean allDependenciesResolved = true;
          if (resource.getRequireFeature() != null) {
              for (String featureName : resource.getRequireFeature()) {
  
                  // Check that the sample actually exists
                  ProvisioningFeatureDefinition feature = resolverRepository.getFeature(featureName);
                  if (feature == null) {
                      allDependenciesResolved = false;
                      // Unless we know it exists but applies to another product, note the missing requirement as well
                      if (!requirementsFoundForOtherProducts.contains(featureName)) {
                          missingRequirements.add(new MissingRequirement(featureName, resource));
                      }
                  }
  
                  // Build distance map and check dependencies
                  allDependenciesResolved &= populateMaxDistanceMap(maxDistanceMap, featureName, 1, new HashSet<ProvisioningFeatureDefinition>(), missingRequirements);
              }
          }
  
          if (!allDependenciesResolved) {
              missingTopLevelRequirements.add(resource.getShortName());
              this.missingRequirements.addAll(missingRequirements);
          }
  
          ArrayList<RepositoryResource> installList = new ArrayList<>();
  
          installList.addAll(convertFeatureNamesToResources(maxDistanceMap.keySet()));
          Collections.sort(installList, byMaxDistance(maxDistanceMap));
  
          installList.add(resource);
  
          return installList;
      }
docs: Create a list of resources which should be installed in order to install the given sample.
  <p>
  The install list consists of all the dependencies which are needed by {@code resource}, ordered so that each resource in the list comes after its dependencies.
  
  @param resource the resource which is to be installed
  @return the ordered list of resources to install