code: public static int countUniqueParameters(List<ParameterSpace> allLeaves) {
          List<ParameterSpace> unique = getUniqueObjects(allLeaves);
          int count = 0;
          for (ParameterSpace ps : unique) {
              if (!ps.isLeaf()) {
                  throw new IllegalStateException("Method should only be used with leaf nodes");
              }
              count += ps.numParameters();
          }
          return count;
      }
docs: Count the number of unique parameters in the specified leaf nodes
  
  @param allLeaves Leaf values to count the parameters fore
  @return Number of parameters for all unique objects