code: public double getFitness(List<String> candidate,
                               List<? extends List<String>> population)
      {
          int totalDistance = 0;
          int cityCount = candidate.size();
          for (int i = 0; i < cityCount; i++)
          {
              int nextIndex = i < cityCount - 1 ? i + 1 : 0;
              totalDistance += distances.getDistance(candidate.get(i),
                                                     candidate.get(nextIndex));
          }
          return totalDistance;
      }
docs: Calculates the length of an evolved route.
  @param candidate The route to evaluate.
  @param population {@inheritDoc}
  @return The total distance (in kilometres) of a journey that visits
  each city in order and returns to the starting point.