class KiePMMLRegressionTableRegressionFactory {

    static Map<String, MethodDeclaration> addCategoricalPredictors(final List<CategoricalPredictor> categoricalPredictors, final ClassOrInterfaceDeclaration tableTemplate) {
        predictorsArity.set(0);
        final Map<String, List<CategoricalPredictor>> groupedCollectors = categoricalPredictors.stream()
                .collect(groupingBy(categoricalPredictor -> categoricalPredictor.getField().getValue()));
        return groupedCollectors.entrySet().stream()
                .map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(),
                                                            addGroupedCategoricalPredictor(entry.getValue(),
                                                                                           tableTemplate,
                                                                                           predictorsArity.addAndGet(1))))
                .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey,
                                          AbstractMap.SimpleEntry::getValue));
    }

    private  KiePMMLRegressionTableRegressionFactory();

}