docs: @Override
    public int compare(S solution1, S solution2) {
      int result ;
      if (solution1 == null) {
        if (solution2 == null) {
          result = 0;
        } else {
          result =  1;
        }
      } else if (solution2 == null) {
        result =  -1;
      } else if (solution1.getNumberOfObjectives() <= objectiveId) {
        throw new JMetalException("The solution1 has " + solution1.getNumberOfObjectives()+ " objectives "
            + "and the objective to sort is " + objectiveId) ;
      } else if (solution2.getNumberOfObjectives() <= objectiveId) {
        throw new JMetalException("The solution2 has " + solution2.getNumberOfObjectives()+ " objectives "
            + "and the objective to sort is " + objectiveId) ;
      } else {
        Double objective1 = solution1.getObjective(this.objectiveId);
        Double objective2 = solution2.getObjective(this.objectiveId);
        if (order == Ordering.ASCENDING) {
          result = Double.compare(objective1, objective2);
        } else {
          result = Double.compare(objective2, objective1);
        }
      }
      return result ;
    }