docs: @Override
    public double getDistance(S solution, L solutionList) {
      List<Double> listOfDistances = knnDistances(solution, solutionList) ;
      listOfDistances.sort(Comparator.naturalOrder());
  
      int limit = Math.min(k, listOfDistances.size()) ;
  
      double result ;
      if (limit == 0) {
        result = 0.0 ;
      } else {
        double sum = 0.0;
        for (int i = 0; i < limit; i++) {
          sum += listOfDistances.get(i);
        }
        result = sum/limit ;
      }
      return result;
    }